├── README.md ├── hqt.py └── hqt_example.py /README.md: -------------------------------------------------------------------------------- 1 | PyQt\PySide helper for Houdini 2 | -------------------------- 3 | 4 | ![alt tag](http://www.paulwinex.ru/wp-content/uploads/2015/04/hqt.jpg) 5 | 6 | 7 | [paulwinex.ru](http://paulwinex.ru) 8 | 9 | ### Houdini 13 10 | 11 | This script enables you to use PySide or PyQt4 with Houdini. Main differences from default pyqt_houdini.py are: 12 | 13 | - opportunity to have several widgets open at the same time 14 | 15 | - automaticly apply Houdini-style ui design 16 | 17 | - implemented 3 different modes. It is not required other functions , rather your widget inherits from one of following classes : 18 | - widget: a simple window opening . Works if the widget is created from QWidget or QMainWindow. Main function showUi returns a pointer to widget object. 19 | - dialog: opens the window blocks Houdinis window. To do this you need to create a widget that inherits from QDialog. showUi returns result of the dialogue (bool) and a pointer to the dialogue object. 20 | - menu: If the widget is inherited from QMenu, the menu will open at the current cursor position . showUi returns a pointer to the selected QAction 21 | 22 | ### Houdini 14 and 15 23 | 24 | This script help you to open PySide Widgets in Houdini 14 and 15 as PythonPanel 25 | 26 | - Open widget as child of main Houdini Window 27 | - Insert your widget as Houdini Python Panel without .pypanel file 28 | - [Fix default Houdini stylesheet examples](http://www.paulwinex.ru/hqt_release2/) 29 | 30 | ### Install: 31 | 32 | - Install PySide or PyQt4 to default Python library or to Houdini python library (for Houdini 13 only) 33 | 34 | - Copy hqt.py to PYTHONPATH or PATH. For example: 35 | 36 | $HFS/python27/lib/site-packages/hqt.py 37 | or 38 | $HFS/houdini/python2.7libs/hqt.py 39 | 40 | - Execute code: 41 | 42 | ```python 43 | import hqt 44 | help(hqt) 45 | ``` 46 | 47 | 48 | See [hqt_example.py](https://github.com/paulwinex/hqt/blob/master/hqt_example.py) for details. 49 | 50 | --------------- 51 | #### New in 1.3 52 | 53 | - Support Houdini 15 54 | 55 | - Some stylesheet fix 56 | 57 | - Update help in show function 58 | 59 | 60 | #### Compare Houdini default stylesheet and hqt stylesheet 61 | 62 | ![alt tag](http://www.paulwinex.ru/wp-content/uploads/2015/03/compare_1.png) 63 | ![alt tag](http://www.paulwinex.ru/wp-content/uploads/2015/03/compare_2.png) 64 | ![alt tag](http://www.paulwinex.ru/wp-content/uploads/2015/03/compare_3.png) 65 | -------------------------------------------------------------------------------- /hqt_example.py: -------------------------------------------------------------------------------- 1 | # EXAMPLES Houdini 13 2 | 3 | ################################# Simple widget 4 | # import hqt 5 | import hqt 6 | # import my module with widget class 7 | import myWidget 8 | # just send widget class to hqt to open 9 | hqt.showUi(myWidget.windowClass) 10 | 11 | 12 | ################################# Modified widget 13 | # If you need to modify widget before show or send arguments to creator 14 | # you need to get QApplication before create widget manualy 15 | #import hqt 16 | import hqt 17 | # import my module with widget class 18 | import myWidget 19 | # get application 20 | app = hqt.application() 21 | # create my widget with arguments 22 | args = [1,2,3] 23 | window = myWidget.windowClass(args) 24 | # modify after create 25 | window.move(10,20) 26 | # send to hqt to show 27 | hqt.showUi(window, app) 28 | 29 | ################################# Communicate Widget 30 | # hqt.showUi return widget object. You can use it after open. 31 | 32 | import hqt 33 | class myWidget(hqt.QWidget): 34 | def __init__(self): 35 | super(myWidget, self).__init__() 36 | w = hqt.showUi(myWidget) 37 | # exec some methods or modify widget 38 | # Window already opened 39 | w.someMethod() 40 | w.resize(100,200) 41 | 42 | ################################# Dialog 43 | import hqt 44 | class myDialog(hqt.QDialog): 45 | def __init__(self): 46 | super(myDialog, self).__init__(None) 47 | self.setWindowTitle('Test Dialog') 48 | self.resize(200,200) 49 | 50 | result, dialog = hqt.showUi(myDialog) 51 | if result: 52 | #read some data from dialog 53 | pass 54 | 55 | ################################# Menu 56 | # Open menu in current cursor pos 57 | 58 | import hqt 59 | class myMenu(hqt.QMenu): 60 | def __init__(self): 61 | super(myMenu, self).__init__() 62 | for i in range(10): 63 | self.addAction(hqt.QAction('Item %s' % i, self)) 64 | 65 | action = hqt.showUi(myMenu) 66 | # get data from action object 67 | print action.text() 68 | 69 | 70 | ######################################################################################## 14 71 | 72 | # EXAMPLES HOUDINI 14 73 | 74 | ########## Simple Window 75 | import myWidget 76 | import hqt 77 | w = myWidget() 78 | w.setParent(hqt.getHouWindow()) 79 | w.setStyleSheet(hqt.get_h14_style()) 80 | w.show() 81 | 82 | ######## Insert as Panel 83 | import hqt 84 | #1 85 | import myWidget 86 | # in panel 87 | hqt.show(myWidget.mainWindow, name='My Widget',replacePyPanel=1, hideTitleMenu=0) 88 | # floating 89 | hqt.show(myWidget.mainWindow, floating=1, position=(200,300), size=(300,400)) 90 | 91 | --------------------------------------------------------------------------------