clean up & cosmetic fix

This commit is contained in:
Kayla Man 2023-05-26 12:56:11 +08:00
parent 682d8e6b05
commit 3ece2a8fcf
2 changed files with 11 additions and 6 deletions

View file

@ -2362,7 +2362,7 @@ class WorkfileSettings(object):
from openpype.widgets import custom_popup
parent = get_main_window()
dialog = custom_popup.CustomScriptDialog(parent=parent)
dialog.setWindowTitle("Frame Range for Read Node")
dialog.setWindowTitle("Frame Range")
dialog.set_name("Frame Range: ")
dialog.set_line_edit("%s - %s" % (nuke.root().firstFrame(),
nuke.root().lastFrame()))
@ -2371,9 +2371,12 @@ class WorkfileSettings(object):
dialog.on_clicked.connect(
lambda: set_frame_range(frame, selection)
)
def set_frame_range(frame, selection):
frame_range = frame.text()
selected = selection.isChecked()
if not nuke.allNodes("Read"):
return
for read_node in nuke.allNodes("Read"):
if selected:
if not nuke.selectedNodes():

View file

@ -16,7 +16,9 @@ class CustomScriptDialog(QtWidgets.QDialog):
on_line_changed = QtCore.Signal(str)
def __init__(self, parent=None, *args, **kwargs):
super(CustomScriptDialog, self).__init__(parent=parent, *args, **kwargs)
super(CustomScriptDialog, self).__init__(parent=parent,
*args,
**kwargs)
self.setContentsMargins(0, 0, 0, 0)
# Layout
@ -30,7 +32,7 @@ class CustomScriptDialog(QtWidgets.QDialog):
# Increase spacing slightly for readability
line_layout.setSpacing(10)
button_layout.setSpacing(8)
button_layout.setSpacing(10)
name = QtWidgets.QLabel("")
name.setStyleSheet("""
QLabel {
@ -47,7 +49,7 @@ class CustomScriptDialog(QtWidgets.QDialog):
has_selection = QtWidgets.QCheckBox()
button = QtWidgets.QPushButton("Execute")
button.setSizePolicy(QtWidgets.QSizePolicy.Maximum,
QtWidgets.QSizePolicy.Maximum)
QtWidgets.QSizePolicy.Maximum)
cancel = QtWidgets.QPushButton("Cancel")
cancel.setSizePolicy(QtWidgets.QSizePolicy.Maximum,
QtWidgets.QSizePolicy.Maximum)
@ -62,7 +64,7 @@ class CustomScriptDialog(QtWidgets.QDialog):
layout.addLayout(selection_layout)
layout.addLayout(button_layout)
# Default size
self.resize(100, 30)
self.resize(100, 40)
self.widgets = {
"name": name,
@ -107,7 +109,6 @@ class CustomScriptDialog(QtWidgets.QDialog):
self.on_line_changed.emit(line_edit)
return self.set_line_edit(line_edit)
def _on_clicked(self):
"""Callback for when the 'show' button is clicked.
@ -129,6 +130,7 @@ class CustomScriptDialog(QtWidgets.QDialog):
# Position popup based on contents on show event
return super(CustomScriptDialog, self).showEvent(event)
@contextlib.contextmanager
def application():
app = QtWidgets.QApplication(sys.argv)