roy's comment and uses import instead of from..import

This commit is contained in:
Kayla Man 2023-05-31 20:02:05 +08:00
parent debd40b119
commit 11728bae0e
2 changed files with 5 additions and 14 deletions

View file

@ -23,10 +23,7 @@ def get_main_window():
class CustomScriptDialog(QtWidgets.QDialog):
"""A Popup that moves itself to bottom right of screen on show event.
The UI contains a message label and a red highlighted button to "show"
or perform another custom action from this pop-up.
"""A Custom Popup For Nuke Read Node
"""
@ -95,7 +92,7 @@ class CustomScriptDialog(QtWidgets.QDialog):
"cancel": cancel
}
# Signals
has_selection.toggled.connect(self.emit_click_with_state)
has_selection.toggled.connect(self.on_checked_changed)
line_edit.textChanged.connect(self.on_line_edit_changed)
button.clicked.connect(self._on_clicked)
cancel.clicked.connect(self.close)
@ -104,10 +101,9 @@ class CustomScriptDialog(QtWidgets.QDialog):
self.setWindowTitle("Custom Popup")
def update_values(self):
self.widgets["selection"].isChecked()
return self.widgets["selection"].isChecked()
def emit_click_with_state(self):
"""Emit the on_clicked signal with the toggled state"""
def on_checked_changed(self):
checked = self.widgets["selection"].isChecked()
return checked
@ -164,11 +160,6 @@ class CustomScriptDialog(QtWidgets.QDialog):
return False
def showEvent(self, event):
# Position popup based on contents on show event
return super(CustomScriptDialog, self).showEvent(event)
@contextlib.contextmanager
def application():
app = QtWidgets.QApplication(sys.argv)

View file

@ -227,7 +227,7 @@
"type": "action",
"sourcetype": "python",
"title": "Set Frame Range(Read Node)",
"command": "from openpype.hosts.nuke.startup import custom_popup;from openpype.hosts.nuke.startup.custom_popup import get_main_window;custom_popup.CustomScriptDialog(parent=get_main_window()).show();",
"command": "import openpype.hosts.nuke.startup.custom_popup as popup;popup.CustomScriptDialog(parent=popup.get_main_window()).show();",
"tooltip": "Set Frame Range for Read Node(s)"
}
]