Last active
May 31, 2016 15:08
-
-
Save fredrikaverpil/8e2e4c948d705da8209bc5440726825d to your computer and use it in GitHub Desktop.
nuke panel test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<ui version="4.0"> | |
<class>Form</class> | |
<widget class="QWidget" name="Form"> | |
<property name="geometry"> | |
<rect> | |
<x>0</x> | |
<y>0</y> | |
<width>961</width> | |
<height>651</height> | |
</rect> | |
</property> | |
<property name="windowTitle"> | |
<string>Form</string> | |
</property> | |
<layout class="QGridLayout" name="gridLayout"> | |
<item row="0" column="0"> | |
<layout class="QVBoxLayout" name="verticalLayout"> | |
<item> | |
<widget class="QPushButton" name="pushButton"> | |
<property name="text"> | |
<string>PushButton</string> | |
</property> | |
</widget> | |
</item> | |
</layout> | |
</item> | |
</layout> | |
</widget> | |
<resources/> | |
<connections/> | |
</ui> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide import QtGui | |
from PySide import QtUiTools | |
import nuke | |
import nukescripts | |
WINDOW_TITLE = 'Boilerplate' | |
WINDOW_OBJECT = 'boilerPlate' | |
UI_DIR = 'C:/Users/fredrik/Desktop' | |
class Boilerplate(QtGui.QWidget): | |
def __init__(self, parent=None): | |
super(Boilerplate, self).__init__() | |
# Filepaths | |
main_window_file = os.path.join(UI_DIR, 'main.ui') | |
module_file = os.path.join(UI_DIR, 'module.ui') | |
# Load UIs | |
self.ui = QtUiTools.QUiLoader().load(main_window_file) # Main window | |
self.ui.module = QtUiTools.QUiLoader().load(module_file) # Module | |
# Set object name and window title | |
self.ui.setObjectName(WINDOW_OBJECT) | |
self.ui.setWindowTitle(WINDOW_TITLE) | |
# Attach module to main window | |
self.ui.verticalLayout.addWidget(self.ui.module) | |
# Just show the UI | |
# window = Boilerplate() | |
# window.ui.show() | |
# Register the UI as a panel | |
panel = nukescripts.panels.registerWidgetAsPanel('Boilerplate', 'Test panel', 'uk.co.thefoundry.Boilerplate' ) | |
pane = nuke.getPaneFor('Properties.1') | |
panel.addToPane(pane) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment