From d4390b067b6a8f6ed25cea866694d7f60f09fd77 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 19:58:07 +0200 Subject: [PATCH 01/26] feat: add a `Browse` button, not visible by default --- cuesubmit/cuesubmit/ui/Widgets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Widgets.py b/cuesubmit/cuesubmit/ui/Widgets.py index 1bcf9b951..c3724fc46 100644 --- a/cuesubmit/cuesubmit/ui/Widgets.py +++ b/cuesubmit/cuesubmit/ui/Widgets.py @@ -53,6 +53,7 @@ def __init__(self, labelText=None, defaultText='', tooltip=None, validators=None self.label.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.lineEdit = CueLineEdit(defaultText, completerStrings=completers) self.lineEdit.setToolTip(tooltip) + self.browseButton = QtWidgets.QPushButton(text='Browse') self.horizontalLine = CueHLine() self.validators = validators or [] self.setupUi() @@ -64,6 +65,7 @@ def setupUi(self): self.setLayout(self.mainLayout) self.mainLayout.addWidget(self.label, 0, 0, 1, 1) self.mainLayout.addWidget(self.lineEdit, 1, 0, 1, 4) + self.browseButton.setVisible(False) self.mainLayout.addWidget(self.horizontalLine, 2, 0, 1, 4) self.label.setStyleSheet(Style.LABEL_TEXT) From 1094b1961d79de4fa8fd4cf9afb2749aaebb094b Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:00:12 +0200 Subject: [PATCH 02/26] feat: add 2 functions `getFolder` and `getFile` (with optional file filter) --- cuesubmit/cuesubmit/ui/Widgets.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Widgets.py b/cuesubmit/cuesubmit/ui/Widgets.py index c3724fc46..967b37f74 100644 --- a/cuesubmit/cuesubmit/ui/Widgets.py +++ b/cuesubmit/cuesubmit/ui/Widgets.py @@ -450,6 +450,23 @@ def separatorLine(): line.setStyleSheet(Style.SEPARATOR_LINE) return line +def getFile(fileFilter=None): + """ Opens a file browser and returns the result + :param fileFilter: optional filters (ex: "Maya Ascii File (*.ma);;Maya Binary File (*.mb);;Maya Files (*.ma *.mb)") + :type fileFilter: str + :returns: Name of the file + :rtype: str + """ + filename, _ = QtWidgets.QFileDialog.getOpenFileName(caption='Select file', dir='.', filter=fileFilter) + return filename + +def getFolder(): + """ Opens a folder browser and returns the result + :returns: Name of the folder + :rtype: str + """ + folder = QtWidgets.QFileDialog.getExistingDirectory(caption='Select folder', dir='.', filter='') + return folder class CueMessageBox(QtWidgets.QMessageBox): """A QMessageBox with message and OK button.""" From 2c78cb04b682e72925aade17268ad2113645206e Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:02:05 +0200 Subject: [PATCH 03/26] feat: add wrappers to `getFile` and `getFolder` to set the returned result on the calling widget --- cuesubmit/cuesubmit/ui/Widgets.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Widgets.py b/cuesubmit/cuesubmit/ui/Widgets.py index 967b37f74..cb8672bed 100644 --- a/cuesubmit/cuesubmit/ui/Widgets.py +++ b/cuesubmit/cuesubmit/ui/Widgets.py @@ -468,6 +468,24 @@ def getFolder(): folder = QtWidgets.QFileDialog.getExistingDirectory(caption='Select folder', dir='.', filter='') return folder +def _setBrowseFileText(widget_setter, fileFilter, *args, **kwargs): + """ wrapper function to open a fileBrowser and set its result back in the widget + :param widget_setter: widget's function to set its text + :type widget_setter: function + :param fileFilter: optional filters (ex: "Maya Ascii File (*.ma);;Maya Binary File (*.mb);;Maya Files (*.ma *.mb)") + :type fileFilter: str + """ + result = getFile(fileFilter) + widget_setter(result) + +def _setBrowseFolderText(widget_setter, *args, **kwargs): + """ wrapper function to open a folderBrowser and set its result back in the widget + :param widget_setter: widget's function to set its text + :type widget_setter: function + """ + result = getFolder() + widget_setter(result) + class CueMessageBox(QtWidgets.QMessageBox): """A QMessageBox with message and OK button.""" From 9b93f726553cbda6a2a4a1419bf30a2a67d23683 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:09:25 +0200 Subject: [PATCH 04/26] feat: add functions to display the browse button and attach wrappers that feeds the lineEdit widget with browse result. --- cuesubmit/cuesubmit/ui/Widgets.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Widgets.py b/cuesubmit/cuesubmit/ui/Widgets.py index cb8672bed..8f0b10fb6 100644 --- a/cuesubmit/cuesubmit/ui/Widgets.py +++ b/cuesubmit/cuesubmit/ui/Widgets.py @@ -21,6 +21,7 @@ from __future__ import absolute_import from builtins import object +from functools import partial from PySide2 import QtCore, QtGui, QtWidgets from cuesubmit import Constants @@ -76,6 +77,32 @@ def setupConnections(self): self.lineEdit.focusChange.connect(self.textFocusChange) # pylint: enable=no-member + def setFileBrowsable(self, fileFilter=None): + """ Displays the Browse button and hook it to a fileBrowser with optional file filters + + :param fileFilter: single or multiple file filters (ex: 'Maya Ascii File (*.ma)') + :type fileFilter: str or list + """ + self._showBrowseButton() + if isinstance(fileFilter, (list, tuple)): + fileFilter = ';;'.join(fileFilter) + self.browseButton.clicked.connect(partial(_setBrowseFileText, + widget_setter=self.setter, + fileFilter=fileFilter)) + + def setFolderBrowsable(self): + """ Displays the Browse button and hook it to a folderBrowser """ + self._showBrowseButton() + self.browseButton.clicked.connect(partial(_setBrowseFolderText, + widget_setter=self.setter)) + + def _showBrowseButton(self): + """ Re-layout lineEdit and browse button and display it """ + self.mainLayout.removeWidget(self.lineEdit) + self.mainLayout.addWidget(self.lineEdit, 1, 0, 1, 3) + self.mainLayout.addWidget(self.browseButton, 1, 3, 1, 1) + self.browseButton.setVisible(True) + def setText(self, text): """Set the text to the given value. @type text: str From ac4ef690f65c03470d1166fda22a07d1124f0add Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:44:56 +0200 Subject: [PATCH 05/26] feat: Make `BaseMayaSettings` and `InMayaSettings` browsable with file filter --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index 01601265a..b1d06c388 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -54,16 +54,24 @@ class InMayaSettings(BaseSettingsWidget): def __init__(self, cameras=None, filename=None, parent=None, *args, **kwargs): super(InMayaSettings, self).__init__(parent=parent) self.mayaFileInput = Widgets.CueLabelLineEdit('Maya File:', filename) + self.fileFilters = ['Maya Ascii file (*.ma)', + 'Maya Binary file (*.mb)', + 'Maya file (*.ma *.mb)'] self.cameraSelector = Widgets.CueSelectPulldown('Render Cameras', options=cameras) self.selectorLayout = QtWidgets.QHBoxLayout() self.setupUi() + self.setupConnections() def setupUi(self): """Creates the Maya-specific widget layout.""" self.mainLayout.addWidget(self.mayaFileInput) self.selectorLayout.addWidget(self.cameraSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) - self.mainLayout.addLayout(self.selectorLayout) + + def setupConnections(self): + """Sets up widget signals.""" + self.mayaFileInput.lineEdit.textChanged.connect(self.dataChanged.emit) # pylint: disable=no-member + self.mayaFileInput.setFileBrowsable(fileFilter=self.fileFilters) def setCommandData(self, commandData): self.mayaFileInput.setText(commandData.get('mayaFile', '')) @@ -83,6 +91,9 @@ class BaseMayaSettings(BaseSettingsWidget): def __init__(self, parent=None, *args, **kwargs): super(BaseMayaSettings, self).__init__(parent=parent) self.mayaFileInput = Widgets.CueLabelLineEdit('Maya File:') + self.fileFilters = ['Maya Ascii file (*.ma)', + 'Maya Binary file (*.mb)', + 'Maya file (*.ma *.mb)'] self.setupUi() self.setupConnections() @@ -93,6 +104,7 @@ def setupUi(self): def setupConnections(self): """Sets up widget signals.""" self.mayaFileInput.lineEdit.textChanged.connect(self.dataChanged.emit) # pylint: disable=no-member + self.mayaFileInput.setFileBrowsable(fileFilter=self.fileFilters) def setCommandData(self, commandData): self.mayaFileInput.setText(commandData.get('mayaFile', '')) From ca2fa7de70bfd7ce682352c5481404ee0e4ef6b2 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:46:04 +0200 Subject: [PATCH 06/26] feat: Make `BaseNukeSettings` and `InNukeSettings` browsable with file filter --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index b1d06c388..3167e5bb1 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -122,17 +122,23 @@ class InNukeSettings(BaseSettingsWidget): def __init__(self, writeNodes=None, filename=None, parent=None, *args, **kwargs): super(InNukeSettings, self).__init__(parent=parent) self.fileInput = Widgets.CueLabelLineEdit('Nuke File:', filename) + self.fileFilters = ['Nuke script file (*.nk)'] self.writeNodeSelector = Widgets.CueSelectPulldown('Write Nodes:', emptyText='[All]', options=writeNodes) self.selectorLayout = QtWidgets.QHBoxLayout() self.setupUi() + self.setupConnections() def setupUi(self): """Creates the Nuke-specific widget layout.""" self.mainLayout.addWidget(self.fileInput) self.selectorLayout.addWidget(self.writeNodeSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) - self.mainLayout.addLayout(self.selectorLayout) + + def setupConnections(self): + """Sets up widget signals.""" + self.fileInput.lineEdit.textChanged.connect(self.dataChanged.emit) # pylint: disable=no-member + self.fileInput.setFileBrowsable(fileFilter=self.fileFilters) def setCommandData(self, commandData): self.fileInput.setText(commandData.get('nukeFile', '')) @@ -152,6 +158,7 @@ class BaseNukeSettings(BaseSettingsWidget): def __init__(self, parent=None, *args, **kwargs): super(BaseNukeSettings, self).__init__(parent=parent) self.fileInput = Widgets.CueLabelLineEdit('Nuke File:') + self.fileFilters = ['Nuke script file (*.nk)'] self.setupUi() self.setupConnections() @@ -162,6 +169,7 @@ def setupUi(self): def setupConnections(self): """Sets up widget signals.""" self.fileInput.lineEdit.textChanged.connect(self.dataChanged.emit) # pylint: disable=no-member + self.fileInput.setFileBrowsable(fileFilter=self.fileFilters) def setCommandData(self, commandData): self.fileInput.setText(commandData.get('nukeFile', '')) From 9ffd3a61de211f682035a924407043be95cca8fc Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:47:11 +0200 Subject: [PATCH 07/26] feat: Make `BaseBlenderSettings` browsable with file filter --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index 3167e5bb1..5b811b08f 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -213,6 +213,7 @@ class BaseBlenderSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, parent=None, *args, **kwargs): super(BaseBlenderSettings, self).__init__(parent=parent) + self.fileFilters = ['Blender file (*.blend)'] self.fileInput = Widgets.CueLabelLineEdit('Blender File:') self.outputPath = Widgets.CueLabelLineEdit( 'Output Path (Optional):', @@ -237,6 +238,7 @@ def setupConnections(self): # pylint: disable=no-member self.fileInput.lineEdit.textChanged.connect(self.dataChanged.emit) self.outputPath.lineEdit.textChanged.connect(self.dataChanged.emit) + self.fileInput.setFileBrowsable(fileFilter=self.fileFilters) # pylint: enable=no-member def setCommandData(self, commandData): From f8cd0f9b1a3df871b3b00029bc84c01385368e04 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 21:29:49 +0200 Subject: [PATCH 08/26] feat!: Group all job specific widgets in a groupBox with title --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 26 ++++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index 01601265a..33f36dda0 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -35,6 +35,11 @@ class BaseSettingsWidget(QtWidgets.QWidget): def __init__(self, parent=None): super(BaseSettingsWidget, self).__init__(parent) self.mainLayout = QtWidgets.QVBoxLayout() + self.groupBox = QtWidgets.QGroupBox('options') + self.groupLayout = QtWidgets.QVBoxLayout() + self.groupBox.setLayout(self.groupLayout) + self.groupBox.setStyleSheet(Widgets.Style.GROUP_BOX) + self.mainLayout.addWidget(self.groupBox) self.setLayout(self.mainLayout) self.mainLayout.setContentsMargins(0, 0, 0, 0) @@ -53,6 +58,7 @@ class InMayaSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, cameras=None, filename=None, parent=None, *args, **kwargs): super(InMayaSettings, self).__init__(parent=parent) + self.groupBox.setTitle('Maya options') self.mayaFileInput = Widgets.CueLabelLineEdit('Maya File:', filename) self.cameraSelector = Widgets.CueSelectPulldown('Render Cameras', options=cameras) self.selectorLayout = QtWidgets.QHBoxLayout() @@ -60,7 +66,7 @@ def __init__(self, cameras=None, filename=None, parent=None, *args, **kwargs): def setupUi(self): """Creates the Maya-specific widget layout.""" - self.mainLayout.addWidget(self.mayaFileInput) + self.groupLayout.addWidget(self.mayaFileInput) self.selectorLayout.addWidget(self.cameraSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) self.mainLayout.addLayout(self.selectorLayout) @@ -82,13 +88,14 @@ class BaseMayaSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, parent=None, *args, **kwargs): super(BaseMayaSettings, self).__init__(parent=parent) + self.groupBox.setTitle('Maya options') self.mayaFileInput = Widgets.CueLabelLineEdit('Maya File:') self.setupUi() self.setupConnections() def setupUi(self): """Creates the widget layout with a single input for the path to the Maya scene.""" - self.mainLayout.addWidget(self.mayaFileInput) + self.groupLayout.addWidget(self.mayaFileInput) def setupConnections(self): """Sets up widget signals.""" @@ -109,6 +116,7 @@ class InNukeSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, writeNodes=None, filename=None, parent=None, *args, **kwargs): super(InNukeSettings, self).__init__(parent=parent) + self.groupBox.setTitle('Nuke options') self.fileInput = Widgets.CueLabelLineEdit('Nuke File:', filename) self.writeNodeSelector = Widgets.CueSelectPulldown('Write Nodes:', emptyText='[All]', options=writeNodes) @@ -117,7 +125,7 @@ def __init__(self, writeNodes=None, filename=None, parent=None, *args, **kwargs) def setupUi(self): """Creates the Nuke-specific widget layout.""" - self.mainLayout.addWidget(self.fileInput) + self.groupLayout.addWidget(self.fileInput) self.selectorLayout.addWidget(self.writeNodeSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) self.mainLayout.addLayout(self.selectorLayout) @@ -139,13 +147,14 @@ class BaseNukeSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, parent=None, *args, **kwargs): super(BaseNukeSettings, self).__init__(parent=parent) + self.groupBox.setTitle('Nuke options') self.fileInput = Widgets.CueLabelLineEdit('Nuke File:') self.setupUi() self.setupConnections() def setupUi(self): """Creates the widget layout with a single input for the path to the Nuke script.""" - self.mainLayout.addWidget(self.fileInput) + self.groupLayout.addWidget(self.fileInput) def setupConnections(self): """Sets up widget signals.""" @@ -166,7 +175,7 @@ class ShellSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, parent=None, *args, **kwargs): super(ShellSettings, self).__init__(parent=parent) - + self.groupBox.setTitle('Shell options') self.commandTextBox = Command.CueCommandWidget() self.setupUi() @@ -174,7 +183,7 @@ def __init__(self, parent=None, *args, **kwargs): def setupUi(self): """Creates the widget layout with a single input for the shell command.""" - self.mainLayout.addWidget(self.commandTextBox) + self.groupLayout.addWidget(self.commandTextBox) def setupConnections(self): """Sets up widget signals.""" @@ -193,6 +202,7 @@ class BaseBlenderSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, parent=None, *args, **kwargs): super(BaseBlenderSettings, self).__init__(parent=parent) + self.groupBox.setTitle('Blender options') self.fileInput = Widgets.CueLabelLineEdit('Blender File:') self.outputPath = Widgets.CueLabelLineEdit( 'Output Path (Optional):', @@ -207,8 +217,8 @@ def __init__(self, parent=None, *args, **kwargs): def setupUi(self): """Creates the Blender-specific widget layout.""" - self.mainLayout.addWidget(self.fileInput) - self.mainLayout.addLayout(self.outputLayout) + self.groupLayout.addWidget(self.fileInput) + self.groupLayout.addLayout(self.outputLayout) self.outputLayout.addWidget(self.outputPath) self.outputLayout.addWidget(self.outputSelector) From 088c84ba7783d1fe7e2d2ea1f411a0510e207e54 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 21:32:23 +0200 Subject: [PATCH 09/26] feat: moved job specific widget group below job setup widgets --- cuesubmit/cuesubmit/ui/Submit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cuesubmit/cuesubmit/ui/Submit.py b/cuesubmit/cuesubmit/ui/Submit.py index 1e0246d17..3e5d0385b 100644 --- a/cuesubmit/cuesubmit/ui/Submit.py +++ b/cuesubmit/cuesubmit/ui/Submit.py @@ -264,8 +264,6 @@ def setupUi(self): self.scrollingLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.VERTICAL)) self.scrollingLayout.addWidget(Widgets.CueLabelLine('Layer Info')) self.layerInfoLayout.addWidget(self.layerNameInput) - self.settingsLayout.addWidget(self.settingsWidget) - self.layerInfoLayout.addLayout(self.settingsLayout) self.layerInfoLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.VERTICAL)) self.layerInfoLayout.addWidget(self.frameBox) @@ -282,6 +280,9 @@ def setupUi(self): self.layerInfoLayout.addLayout(self.coresLayout) self.scrollingLayout.addLayout(self.layerInfoLayout) + self.settingsLayout.addWidget(self.settingsWidget) + self.layerInfoLayout.addLayout(self.settingsLayout) + self.scrollingLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.VERTICAL)) self.scrollingLayout.addWidget(Widgets.CueLabelLine('Submission Details')) From b4085a28e224125b79afaf84d133ca08f0d46916 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 21:39:57 +0200 Subject: [PATCH 10/26] feat: add styling for QGroupBox --- cuesubmit/cuesubmit/ui/Style.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Style.py b/cuesubmit/cuesubmit/ui/Style.py index 6e3211b94..bfd26c549 100644 --- a/cuesubmit/cuesubmit/ui/Style.py +++ b/cuesubmit/cuesubmit/ui/Style.py @@ -173,6 +173,14 @@ } """ +GROUP_BOX = """ +QGroupBox { + border: 3px solid rgb(30, 40, 50); + border-radius: 6px; + font-size: 8pt; +} +""" + SEPARATOR_LINE = 'border: 1px solid rgb(20, 30, 40)' TEXT = 'background-color: rgb(40, 50, 60); color: rgb(250, 250, 250); font-weight: regular;' From f4f11a4e5d57675db98d90eb4b4c8db273bd6e0e Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:15:39 +0200 Subject: [PATCH 11/26] feat: add `greyOut()` function to `CueLabelLineEdit` --- cuesubmit/cuesubmit/ui/Widgets.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Widgets.py b/cuesubmit/cuesubmit/ui/Widgets.py index 1bcf9b951..3834e2cb2 100644 --- a/cuesubmit/cuesubmit/ui/Widgets.py +++ b/cuesubmit/cuesubmit/ui/Widgets.py @@ -104,6 +104,11 @@ def text(self): """ return self.lineEdit.text() + def greyOut(self): + """Make widget grey and read-only""" + self.lineEdit.setReadOnly(True) + self.lineEdit.setStyleSheet(Style.DISABLED_LINE_EDIT) + class CueLineEdit(QtWidgets.QLineEdit): """Wrapper around QLineEdit that allows for changing text with up/down arrow keys.""" From 1c07ab75096647c5bc9d0effb17218aad4e50d01 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:16:28 +0200 Subject: [PATCH 12/26] feat: add styling for disabled `CueLabelLineEdit` --- cuesubmit/cuesubmit/ui/Style.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Style.py b/cuesubmit/cuesubmit/ui/Style.py index 6e3211b94..eae60a999 100644 --- a/cuesubmit/cuesubmit/ui/Style.py +++ b/cuesubmit/cuesubmit/ui/Style.py @@ -173,6 +173,15 @@ } """ +DISABLED_LINE_EDIT = """ +QLineEdit { + color: rgb(110, 110, 110); + border: 0px solid; + background-color: rgb(30, 35, 40); + border-radius: 4px; +} +""" + SEPARATOR_LINE = 'border: 1px solid rgb(20, 30, 40)' TEXT = 'background-color: rgb(40, 50, 60); color: rgb(250, 250, 250); font-weight: regular;' From 694de3363d2b42e9f432f36b21721468cb1c6cca Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:23:10 +0200 Subject: [PATCH 13/26] fix: make maya command use start and end frames instead of fixed single frame. --- cuesubmit/cuesubmit/Submission.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cuesubmit/cuesubmit/Submission.py b/cuesubmit/cuesubmit/Submission.py index 94a1f97b9..d6e5cffa6 100644 --- a/cuesubmit/cuesubmit/Submission.py +++ b/cuesubmit/cuesubmit/Submission.py @@ -36,8 +36,10 @@ def buildMayaCmd(layerData): mayaFile = layerData.cmd.get('mayaFile') if not mayaFile: raise ValueError('No Maya File provided. Cannot submit job.') - renderCommand = '{renderCmd} -r file -s {frameToken} -e {frameToken}'.format( - renderCmd=Constants.MAYA_RENDER_CMD, frameToken=Constants.FRAME_TOKEN) + renderCommand = '{renderCmd} -r file -s {frameStart} -e {frameEnd}'.format( + renderCmd=Constants.MAYA_RENDER_CMD, + frameStart=Constants.FRAME_START, + frameEnd=Constants.FRAME_END) if camera: renderCommand += ' -cam {}'.format(camera) renderCommand += ' {}'.format(mayaFile) From 7ea6eb1b74a37748074f7a2ff80c3162292d8950 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:24:43 +0200 Subject: [PATCH 14/26] feat!: add `silent` argument to `build*Cmd()` functions so we can feed them to the UI before they are fully valid. --- cuesubmit/cuesubmit/Submission.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cuesubmit/cuesubmit/Submission.py b/cuesubmit/cuesubmit/Submission.py index d6e5cffa6..4732e9c03 100644 --- a/cuesubmit/cuesubmit/Submission.py +++ b/cuesubmit/cuesubmit/Submission.py @@ -30,11 +30,11 @@ from cuesubmit import JobTypes -def buildMayaCmd(layerData): +def buildMayaCmd(layerData, silent=False): """From a layer, builds a Maya Render command.""" camera = layerData.cmd.get('camera') mayaFile = layerData.cmd.get('mayaFile') - if not mayaFile: + if not mayaFile and not silent: raise ValueError('No Maya File provided. Cannot submit job.') renderCommand = '{renderCmd} -r file -s {frameStart} -e {frameEnd}'.format( renderCmd=Constants.MAYA_RENDER_CMD, @@ -46,11 +46,11 @@ def buildMayaCmd(layerData): return renderCommand -def buildNukeCmd(layerData): +def buildNukeCmd(layerData, silent=False): """From a layer, builds a Nuke Render command.""" writeNodes = layerData.cmd.get('writeNodes') nukeFile = layerData.cmd.get('nukeFile') - if not nukeFile: + if not nukeFile and not silent: raise ValueError('No Nuke file provided. Cannot submit job.') renderCommand = '{renderCmd} -F {frameToken} '.format( renderCmd=Constants.NUKE_RENDER_CMD, frameToken=Constants.FRAME_TOKEN) @@ -60,12 +60,12 @@ def buildNukeCmd(layerData): return renderCommand -def buildBlenderCmd(layerData): +def buildBlenderCmd(layerData, silent=False): """From a layer, builds a Blender render command.""" blenderFile = layerData.cmd.get('blenderFile') outputPath = layerData.cmd.get('outputPath') outputFormat = layerData.cmd.get('outputFormat') - if not blenderFile: + if not blenderFile and not silent: raise ValueError('No Blender file provided. Cannot submit job.') renderCommand = '{renderCmd} -b -noaudio {blenderFile}'.format( From 52d72912b95541497b4f0ca1b11e0a87985c6277 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:30:07 +0200 Subject: [PATCH 15/26] fix!: remove redundant functions and use the new `silent` argument --- cuesubmit/cuesubmit/Submission.py | 51 +++++++++++-------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/cuesubmit/cuesubmit/Submission.py b/cuesubmit/cuesubmit/Submission.py index 4732e9c03..3c9e604d1 100644 --- a/cuesubmit/cuesubmit/Submission.py +++ b/cuesubmit/cuesubmit/Submission.py @@ -104,29 +104,22 @@ def buildLayer(layerData, command, lastLayer=None): layer.depend_on(lastLayer) return layer - -def buildMayaLayer(layerData, lastLayer): - """Builds a PyOutline layer running a Maya command.""" - mayaCmd = buildMayaCmd(layerData) - return buildLayer(layerData, mayaCmd, lastLayer) - - -def buildNukeLayer(layerData, lastLayer): - """Builds a PyOutline layer running a Nuke command.""" - nukeCmd = buildNukeCmd(layerData) - return buildLayer(layerData, nukeCmd, lastLayer) - - -def buildBlenderLayer(layerData, lastLayer): - """Builds a PyOutline layer running a Blender command.""" - blenderCmd = buildBlenderCmd(layerData) - return buildLayer(layerData, blenderCmd, lastLayer) - - -def buildShellLayer(layerData, lastLayer): - """Builds a PyOutline layer running a shell command.""" - return buildLayer(layerData, layerData.cmd['commandTextBox'], lastLayer) - +def buildLayerCommand(layerData, silent=False): + """Builds the command to be sent per jobType""" + if layerData.layerType == JobTypes.JobTypes.MAYA: + command = buildMayaCmd(layerData, silent) + elif layerData.layerType == JobTypes.JobTypes.SHELL: + command = layerData.cmd.get('commandTextBox') if silent else layerData.cmd['commandTextBox'] + elif layerData.layerType == JobTypes.JobTypes.NUKE: + command = buildNukeCmd(layerData, silent) + elif layerData.layerType == JobTypes.JobTypes.BLENDER: + command = buildBlenderCmd(layerData, silent) + else: + if silent: + command = 'Error: unrecognized layer type {}'.format(layerData.layerType) + else: + raise ValueError('unrecognized layer type {}'.format(layerData.layerType)) + return command def submitJob(jobData): """Submits the job using the PyOutline API.""" @@ -134,16 +127,8 @@ def submitJob(jobData): jobData['name'], shot=jobData['shot'], show=jobData['show'], user=jobData['username']) lastLayer = None for layerData in jobData['layers']: - if layerData.layerType == JobTypes.JobTypes.MAYA: - layer = buildMayaLayer(layerData, lastLayer) - elif layerData.layerType == JobTypes.JobTypes.SHELL: - layer = buildShellLayer(layerData, lastLayer) - elif layerData.layerType == JobTypes.JobTypes.NUKE: - layer = buildNukeLayer(layerData, lastLayer) - elif layerData.layerType == JobTypes.JobTypes.BLENDER: - layer = buildBlenderLayer(layerData, lastLayer) - else: - raise ValueError('unrecognized layer type %s' % layerData.layerType) + command = buildLayerCommand(layerData) + layer = buildLayer(layerData, command, lastLayer) ol.add_layer(layer) lastLayer = layer From fc96503d709514e0a57bdabdcaa1f9b9b05e4de2 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:32:07 +0200 Subject: [PATCH 16/26] feat: add constants `FRAME_START` and `FRAME_END` --- cuesubmit/cuesubmit/Constants.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cuesubmit/cuesubmit/Constants.py b/cuesubmit/cuesubmit/Constants.py index 123f32723..27b5b1ccb 100644 --- a/cuesubmit/cuesubmit/Constants.py +++ b/cuesubmit/cuesubmit/Constants.py @@ -38,7 +38,8 @@ NUKE_RENDER_CMD = config.get('NUKE_RENDER_CMD', 'nuke') BLENDER_RENDER_CMD = config.get('BLENDER_RENDER_CMD', 'blender') FRAME_TOKEN = config.get('FRAME_TOKEN', '#IFRAME#') - +FRAME_START = '#FRAME_START#' +FRAME_END = '#FRAME_END#' BLENDER_FORMATS = ['', 'AVIJPEG', 'AVIRAW', 'BMP', 'CINEON', 'DPX', 'EXR', 'HDR', 'IRIS', 'IRIZ', 'JP2', 'JPEG', 'MPEG', 'MULTILAYER', 'PNG', 'RAWTGA', 'TGA', 'TIFF'] BLENDER_OUTPUT_OPTIONS_URL = \ From 28a3d02893b530a92465842d159530c57c1bdb75 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:33:30 +0200 Subject: [PATCH 17/26] fix!: FRAME_TOKEN must not be configurable as it is not forwarded to the java code replacing it with the proper value. --- cuesubmit/cuesubmit/Constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuesubmit/cuesubmit/Constants.py b/cuesubmit/cuesubmit/Constants.py index 27b5b1ccb..0dfe9e916 100644 --- a/cuesubmit/cuesubmit/Constants.py +++ b/cuesubmit/cuesubmit/Constants.py @@ -37,7 +37,7 @@ MAYA_RENDER_CMD = config.get('MAYA_RENDER_CMD', 'Render') NUKE_RENDER_CMD = config.get('NUKE_RENDER_CMD', 'nuke') BLENDER_RENDER_CMD = config.get('BLENDER_RENDER_CMD', 'blender') -FRAME_TOKEN = config.get('FRAME_TOKEN', '#IFRAME#') +FRAME_TOKEN = '#IFRAME#' FRAME_START = '#FRAME_START#' FRAME_END = '#FRAME_END#' BLENDER_FORMATS = ['', 'AVIJPEG', 'AVIRAW', 'BMP', 'CINEON', 'DPX', 'EXR', 'HDR', 'IRIS', 'IRIZ', From 23142c52f10ee432b77532a89c7962890e18a4e2 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:38:28 +0200 Subject: [PATCH 18/26] feat: add commandFeedback widget in `CueSubmitWidget` and its `updateFeedbackCommand()` function --- cuesubmit/cuesubmit/ui/Submit.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/Submit.py b/cuesubmit/cuesubmit/ui/Submit.py index 1e0246d17..b30764711 100644 --- a/cuesubmit/cuesubmit/ui/Submit.py +++ b/cuesubmit/cuesubmit/ui/Submit.py @@ -202,6 +202,8 @@ def __init__( self.facilitySelector.setChecked(selected_facility) self.settingsWidget = self.jobTypes.build(self.primaryWidgetType, *args, **kwargs) + self.commandFeedback = Widgets.CueLabelLineEdit( labelText='Final command:' ) + self.commandFeedback.greyOut() self.jobTreeWidget = Job.CueJobWidget() self.submitButtons = CueSubmitButtons() self.setupUi() @@ -282,6 +284,8 @@ def setupUi(self): self.layerInfoLayout.addLayout(self.coresLayout) self.scrollingLayout.addLayout(self.layerInfoLayout) + self.layerInfoLayout.addWidget(self.commandFeedback) + self.scrollingLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.VERTICAL)) self.scrollingLayout.addWidget(Widgets.CueLabelLine('Submission Details')) @@ -329,6 +333,7 @@ def jobLayerSelectionChanged(self, layerObject): self.dependSelector.clearChecked() self.dependSelector.setChecked([layerObject.dependType]) self.settingsWidget.setCommandData(layerObject.cmd) + self.updateFeedbackCommand(layerObject) self.skipDataChangedEvent = False def jobDataChanged(self): @@ -351,6 +356,13 @@ def jobDataChanged(self): dependsOn=None ) self.jobTreeWidget.updateJobData(self.jobNameInput.text()) + self.updateFeedbackCommand(self.jobTreeWidget.currentLayerData) + + def updateFeedbackCommand(self, layerData): + """ Builds the final command for this layer and displays it in the feedback widget """ + command = Submission.buildLayerCommand(layerData=layerData, + silent=True) + self.commandFeedback.setText(text=command) def jobTypeChanged(self): """Action when the job type is changed.""" From 59093efe29ed929b75a3bbc551b48f8a2c0b435f Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Fri, 31 Mar 2023 19:33:09 +0200 Subject: [PATCH 19/26] fix: revert 2 deleted lines --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index 5b811b08f..ce4d3197f 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -67,6 +67,7 @@ def setupUi(self): self.mainLayout.addWidget(self.mayaFileInput) self.selectorLayout.addWidget(self.cameraSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) + self.mainLayout.addLayout(self.selectorLayout) def setupConnections(self): """Sets up widget signals.""" @@ -134,6 +135,7 @@ def setupUi(self): self.mainLayout.addWidget(self.fileInput) self.selectorLayout.addWidget(self.writeNodeSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) + self.mainLayout.addLayout(self.selectorLayout) def setupConnections(self): """Sets up widget signals.""" From a9f619381edced984570d3fa58fa80a7f9ade4a7 Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Fri, 31 Mar 2023 19:43:49 +0200 Subject: [PATCH 20/26] fix: update blender command when changing output format --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index 01601265a..2d28215c8 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -217,6 +217,7 @@ def setupConnections(self): # pylint: disable=no-member self.fileInput.lineEdit.textChanged.connect(self.dataChanged.emit) self.outputPath.lineEdit.textChanged.connect(self.dataChanged.emit) + self.outputSelector.optionsMenu.triggered.connect(self.dataChanged.emit) # pylint: enable=no-member def setCommandData(self, commandData): From 425d7faf720e0eafa019277bccb2b085a3c4e39a Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Fri, 31 Mar 2023 19:53:06 +0200 Subject: [PATCH 21/26] fix: update layout var --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index 33f36dda0..a46444ad7 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -69,7 +69,7 @@ def setupUi(self): self.groupLayout.addWidget(self.mayaFileInput) self.selectorLayout.addWidget(self.cameraSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) - self.mainLayout.addLayout(self.selectorLayout) + self.groupLayout.addLayout(self.selectorLayout) def setCommandData(self, commandData): self.mayaFileInput.setText(commandData.get('mayaFile', '')) @@ -128,7 +128,7 @@ def setupUi(self): self.groupLayout.addWidget(self.fileInput) self.selectorLayout.addWidget(self.writeNodeSelector) self.selectorLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) - self.mainLayout.addLayout(self.selectorLayout) + self.groupLayout.addLayout(self.selectorLayout) def setCommandData(self, commandData): self.fileInput.setText(commandData.get('nukeFile', '')) From 67fee41eff7f0d4111cb72f67f9f42c1b4a1ff9f Mon Sep 17 00:00:00 2001 From: Kern Attila Germain <5556461+KernAttila@users.noreply.github.com> Date: Fri, 31 Mar 2023 19:56:47 +0200 Subject: [PATCH 22/26] clean: move line up with sibling --- cuesubmit/cuesubmit/ui/Submit.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cuesubmit/cuesubmit/ui/Submit.py b/cuesubmit/cuesubmit/ui/Submit.py index b30764711..9dbd9c0c0 100644 --- a/cuesubmit/cuesubmit/ui/Submit.py +++ b/cuesubmit/cuesubmit/ui/Submit.py @@ -282,9 +282,8 @@ def setupUi(self): self.coresLayout.addWidget(self.dependSelector) self.coresLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.HORIZONTAL)) self.layerInfoLayout.addLayout(self.coresLayout) - self.scrollingLayout.addLayout(self.layerInfoLayout) - self.layerInfoLayout.addWidget(self.commandFeedback) + self.scrollingLayout.addLayout(self.layerInfoLayout) self.scrollingLayout.addSpacerItem(Widgets.CueSpacerItem(Widgets.SpacerTypes.VERTICAL)) self.scrollingLayout.addWidget(Widgets.CueLabelLine('Submission Details')) From abd2cca3a5b8f9197a35d0628c04cb35554d16b1 Mon Sep 17 00:00:00 2001 From: Kern Attila GERMAIN <5556461+KernAttila@users.noreply.github.com> Date: Tue, 25 Apr 2023 00:48:42 +0200 Subject: [PATCH 23/26] fix: change expected maya command test result --- cuesubmit/tests/Submission_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cuesubmit/tests/Submission_tests.py b/cuesubmit/tests/Submission_tests.py index 751df915a..00f3ad82f 100644 --- a/cuesubmit/tests/Submission_tests.py +++ b/cuesubmit/tests/Submission_tests.py @@ -78,7 +78,7 @@ def testSubmitMayaJob(self, launchMock): self.assertEqual(MAYA_LAYER_DATA['name'], layer.get_name()) self.assertEqual( [ - 'Render', '-r', 'file', '-s', '#IFRAME#', '-e', '#IFRAME#', '-cam', + 'Render', '-r', 'file', '-s', '#FRAME_START#', '-e', '#FRAME_END#', '-cam', MAYA_LAYER_DATA['cmd']['camera'], MAYA_LAYER_DATA['cmd']['mayaFile'] ], layer.get_arg('command') @@ -128,7 +128,7 @@ def testSubmitMayaAndShellJob(self, launchMock): self.assertEqual(MAYA_LAYER_DATA['name'], mayaLayer.get_name()) self.assertEqual( [ - 'Render', '-r', 'file', '-s', '#IFRAME#', '-e', '#IFRAME#', '-cam', + 'Render', '-r', 'file', '-s', '#FRAME_START#', '-e', '#FRAME_END#', '-cam', MAYA_LAYER_DATA['cmd']['camera'], MAYA_LAYER_DATA['cmd']['mayaFile'] ], mayaLayer.get_arg('command') From 2c9757d72f88e78be4bd1bfba310bcbf7d3700c9 Mon Sep 17 00:00:00 2001 From: Kern Attila GERMAIN <5556461+KernAttila@users.noreply.github.com> Date: Tue, 25 Apr 2023 00:57:51 +0200 Subject: [PATCH 24/26] feat: add Constants `MAYA_FILE_FILTERS`, `NUKE_FILE_FILTERS`, `BLENDER_FILE_FILTERS` --- cuesubmit/cuesubmit/Constants.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cuesubmit/cuesubmit/Constants.py b/cuesubmit/cuesubmit/Constants.py index 123f32723..2ceae70fb 100644 --- a/cuesubmit/cuesubmit/Constants.py +++ b/cuesubmit/cuesubmit/Constants.py @@ -39,6 +39,15 @@ BLENDER_RENDER_CMD = config.get('BLENDER_RENDER_CMD', 'blender') FRAME_TOKEN = config.get('FRAME_TOKEN', '#IFRAME#') +MAYA_FILE_FILTERS = [ + 'Maya Ascii file (*.ma)', + 'Maya Binary file (*.mb)', + 'Maya file (*.ma *.mb)' +] +NUKE_FILE_FILTERS = ['Nuke script file (*.nk)'] +BLENDER_FILE_FILTERS = ['Blender file (*.blend)'] + + BLENDER_FORMATS = ['', 'AVIJPEG', 'AVIRAW', 'BMP', 'CINEON', 'DPX', 'EXR', 'HDR', 'IRIS', 'IRIZ', 'JP2', 'JPEG', 'MPEG', 'MULTILAYER', 'PNG', 'RAWTGA', 'TGA', 'TIFF'] BLENDER_OUTPUT_OPTIONS_URL = \ From c30b14685d73d0270485da13c08be6b80b5b81d8 Mon Sep 17 00:00:00 2001 From: Kern Attila GERMAIN <5556461+KernAttila@users.noreply.github.com> Date: Tue, 25 Apr 2023 00:58:12 +0200 Subject: [PATCH 25/26] fix: use Constants `MAYA_FILE_FILTERS`, `NUKE_FILE_FILTERS`, `BLENDER_FILE_FILTERS` --- cuesubmit/cuesubmit/ui/SettingsWidgets.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cuesubmit/cuesubmit/ui/SettingsWidgets.py b/cuesubmit/cuesubmit/ui/SettingsWidgets.py index ce4d3197f..a0be3dd27 100644 --- a/cuesubmit/cuesubmit/ui/SettingsWidgets.py +++ b/cuesubmit/cuesubmit/ui/SettingsWidgets.py @@ -54,9 +54,7 @@ class InMayaSettings(BaseSettingsWidget): def __init__(self, cameras=None, filename=None, parent=None, *args, **kwargs): super(InMayaSettings, self).__init__(parent=parent) self.mayaFileInput = Widgets.CueLabelLineEdit('Maya File:', filename) - self.fileFilters = ['Maya Ascii file (*.ma)', - 'Maya Binary file (*.mb)', - 'Maya file (*.ma *.mb)'] + self.fileFilters = Constants.MAYA_FILE_FILTERS self.cameraSelector = Widgets.CueSelectPulldown('Render Cameras', options=cameras) self.selectorLayout = QtWidgets.QHBoxLayout() self.setupUi() @@ -92,9 +90,7 @@ class BaseMayaSettings(BaseSettingsWidget): def __init__(self, parent=None, *args, **kwargs): super(BaseMayaSettings, self).__init__(parent=parent) self.mayaFileInput = Widgets.CueLabelLineEdit('Maya File:') - self.fileFilters = ['Maya Ascii file (*.ma)', - 'Maya Binary file (*.mb)', - 'Maya file (*.ma *.mb)'] + self.fileFilters = Constants.MAYA_FILE_FILTERS self.setupUi() self.setupConnections() @@ -123,7 +119,7 @@ class InNukeSettings(BaseSettingsWidget): def __init__(self, writeNodes=None, filename=None, parent=None, *args, **kwargs): super(InNukeSettings, self).__init__(parent=parent) self.fileInput = Widgets.CueLabelLineEdit('Nuke File:', filename) - self.fileFilters = ['Nuke script file (*.nk)'] + self.fileFilters = Constants.NUKE_FILE_FILTERS self.writeNodeSelector = Widgets.CueSelectPulldown('Write Nodes:', emptyText='[All]', options=writeNodes) self.selectorLayout = QtWidgets.QHBoxLayout() @@ -160,7 +156,7 @@ class BaseNukeSettings(BaseSettingsWidget): def __init__(self, parent=None, *args, **kwargs): super(BaseNukeSettings, self).__init__(parent=parent) self.fileInput = Widgets.CueLabelLineEdit('Nuke File:') - self.fileFilters = ['Nuke script file (*.nk)'] + self.fileFilters = Constants.NUKE_FILE_FILTERS self.setupUi() self.setupConnections() @@ -215,7 +211,7 @@ class BaseBlenderSettings(BaseSettingsWidget): # pylint: disable=keyword-arg-before-vararg,unused-argument def __init__(self, parent=None, *args, **kwargs): super(BaseBlenderSettings, self).__init__(parent=parent) - self.fileFilters = ['Blender file (*.blend)'] + self.fileFilters = Constants.BLENDER_FILE_FILTERS self.fileInput = Widgets.CueLabelLineEdit('Blender File:') self.outputPath = Widgets.CueLabelLineEdit( 'Output Path (Optional):', From 5c173ccc46c1689d81a5ea327ec64bc261660667 Mon Sep 17 00:00:00 2001 From: Jimmy Christensen Date: Thu, 18 Jul 2024 01:21:14 +0200 Subject: [PATCH 26/26] Added missing CueLabelLineEdit.setter and fixed some linting issues --- cuesubmit/cuesubmit/ui/Widgets.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cuesubmit/cuesubmit/ui/Widgets.py b/cuesubmit/cuesubmit/ui/Widgets.py index 007e0535f..fb16400a9 100644 --- a/cuesubmit/cuesubmit/ui/Widgets.py +++ b/cuesubmit/cuesubmit/ui/Widgets.py @@ -58,6 +58,7 @@ def __init__(self, labelText=None, defaultText='', tooltip=None, validators=None self.browseButton = QtWidgets.QPushButton(text='Browse') self.horizontalLine = CueHLine() self.validators = validators or [] + self.setter = self.setText self.setupUi() self.setupConnections() self.setAutoFillBackground(True) @@ -87,6 +88,7 @@ def setFileBrowsable(self, fileFilter=None): self._showBrowseButton() if isinstance(fileFilter, (list, tuple)): fileFilter = ';;'.join(fileFilter) + # pylint: disable=no-member self.browseButton.clicked.connect(partial(_setBrowseFileText, widget_setter=self.setter, fileFilter=fileFilter)) @@ -94,6 +96,7 @@ def setFileBrowsable(self, fileFilter=None): def setFolderBrowsable(self): """ Displays the Browse button and hook it to a folderBrowser """ self._showBrowseButton() + # pylint: disable=no-member self.browseButton.clicked.connect(partial(_setBrowseFolderText, widget_setter=self.setter)) @@ -567,12 +570,14 @@ def separatorLine(): def getFile(fileFilter=None): """ Opens a file browser and returns the result - :param fileFilter: optional filters (ex: "Maya Ascii File (*.ma);;Maya Binary File (*.mb);;Maya Files (*.ma *.mb)") + :param fileFilter: optional filters (ex: "Maya Ascii File (*.ma);; + Maya Binary File (*.mb);;Maya Files (*.ma *.mb)") :type fileFilter: str :returns: Name of the file :rtype: str """ - filename, _ = QtWidgets.QFileDialog.getOpenFileName(caption='Select file', dir='.', filter=fileFilter) + filename, _ = QtWidgets.QFileDialog.getOpenFileName(caption='Select file', + dir='.', filter=fileFilter) return filename def getFolder(): @@ -580,20 +585,22 @@ def getFolder(): :returns: Name of the folder :rtype: str """ - folder = QtWidgets.QFileDialog.getExistingDirectory(caption='Select folder', dir='.', filter='') + folder = QtWidgets.QFileDialog.getExistingDirectory(caption='Select folder', + dir='.', filter='') return folder -def _setBrowseFileText(widget_setter, fileFilter, *args, **kwargs): +def _setBrowseFileText(widget_setter, fileFilter): """ wrapper function to open a fileBrowser and set its result back in the widget :param widget_setter: widget's function to set its text :type widget_setter: function - :param fileFilter: optional filters (ex: "Maya Ascii File (*.ma);;Maya Binary File (*.mb);;Maya Files (*.ma *.mb)") + :param fileFilter: optional filters (ex: "Maya Ascii File (*.ma);; + Maya Binary File (*.mb);;Maya Files (*.ma *.mb)") :type fileFilter: str """ result = getFile(fileFilter) widget_setter(result) -def _setBrowseFolderText(widget_setter, *args, **kwargs): +def _setBrowseFolderText(widget_setter): """ wrapper function to open a folderBrowser and set its result back in the widget :param widget_setter: widget's function to set its text :type widget_setter: function