For GUI in Nuke, we need to .ui file using QT Designer.
There is one I already made for typical keyboard but you can download it from my github and modify.
I want our own pushbutton so let's promote it to other name
I named it HotKeyButton.
Personally I don't prefer to load .ui file directy from main python file.
I would convert .ui file to .py file using pyuic4 command
Our pyuic4 command is from pyqt4 so let's add try except to load pySide in ui_hotkey.py
so it's done. You are ready to open the ui file in Nuke.
Copy the ui_hotkey.py file to somewhere your Nuke can load. (ex: your homefolder/.nuke)
To show basic Dialog or Widget, you need to have main body class inherited QDialog or QWidget.
If you execute those script, this will show empty dialog.
Let's import our ui_hotkey and call setupUi function of the Ui_Form class.
We have 5 steps to do
1. Check hotkeys (ex: "Nodes/Image/Write", "W")
2. Get HotKeyButton instance corresponding 'KEY' instance
3. Store Key information to HotKeyButton instance.
4. When the Button is clicked, print it to TextBrowser
5. Color HotKeyButton when Viewer Nodes Nuke checkbox is checked.
In https://github.com/hslth/NukeHotKey/ there is code for each step.
In next tutorial, I would introduce some detail code review of each step and check box integretion with HotKeyButton color.
Tae Hyung Lee