3D animation,rigging,coding, math ,fun stuff welcome !

toolUI.py

"""
Copyright (C) 2009 Rick Fronek
melvin.3d@gmail.com

Python Script File:    toolUI.py
Function List:             myCustomUI()
                   


MODIFY THIS AT YOUR OWN RISK

Update Date:    Feb 07 2010

Description:    A sample UI written with Python in Maya 2010
                             Probably the last time I will have fun witing these
                             since 2011 incorporated Qt , which is great but....:)
Install :
                Put it into your maya script dir and then
                rehash or restart maya. Use regular import.

                from toolUI import myCustomUI

"""


import maya.cmds as mc

def myCustomUI():
    """
    ....documentation here ..
   
    """
   
    work = 1
    windowName = 'WIP-PythonWin'
    lWinSize = mc.windowPref('MainWindow' , q=True,wh=True)
   
    if work:
        if mc.window('MainWindow', exists=True, query=True):
            mc.deleteUI('MainWindow', window=True)
            print 'Rebuilding Main Window ........'
           
        # create the window
        mc.window('MainWindow', title=windowName , sizeable=True , menuBar=True)
        mc.menu(l='File', tearOff=True)
       
        # set first Menu items
        mc.menuItem(l='Open')
        mc.menuItem(divider=True)
        mc.menuItem(l='Exit' , command="mc.deleteUI('MainWindow')")
       
        # set second menu items
        mc.menu(l='Edit')
        mc.menuItem(l='ResetUI Size' , command="mc.window('MainWindow' , edit=True , wh=(lWinSize[0] , lWinSize[1]))")
        # set third menu items
        mc.menu(l='Help' , helpMenu=True)
        mc.menuItem(l='Online Help')
        mc.menuItem(l='Work Blog')
        mc.setParent('..')
       
        # main column layout
        mc.columnLayout('mainColumn', adj=True)
        #mc.text(l='' , h=4)
        mc.frameLayout('LabelFrame', borderStyle='etchedIn' , collapsable=False , collapse=True, labelVisible=False)
        mc.rowColumnLayout(numberOfColumns=3 , cw=([1,200],[2,200],[3,200]))
        mc.columnLayout(adj=True)
        mc.text(l='Load Rig Controllers' , font='boldLabelFont')
        mc.setParent('..')
        mc.columnLayout(adj=True)
        mc.text(l='Load Mocap Source' , font='boldLabelFont')
        mc.setParent('..')
        mc.columnLayout(adj=True)
        mc.text(l='Set Options' , font='boldLabelFont')
        mc.setParent('..')
       
        # HIERACHY UI
        mc.setParent('..') ; mc.setParent('..')
       
        # Main frame layout
        mc.frameLayout('mainFrame', borderStyle='etchedIn' , collapsable=False , collapse=True , labelVisible=False , w=200 , h=300)
       
        mc.paneLayout(configuration='vertical3')
        # pane's column 1
        mc.columnLayout(adj=True)
        mc.frameLayout('paneFrameOne' , borderStyle='etchedIn' , collapsable=False , collapse=True ,
                                             labelVisible=False , marginWidth=2 , marginHeight=2)
        mc.textScrollList('myTSL1', h=286 , allowMultiSelection=True , )
        mc.setParent('..') ; mc.setParent('..')
       
        # pane's column 2
        mc.columnLayout(adj=True)
        mc.frameLayout('paneFrameTwo' , borderStyle='etchedIn' , collapsable=False , collapse=True ,
                                             labelVisible=False , marginWidth=2 , marginHeight=2)
        mc.textScrollList('myTSL2'  , h=286, allowMultiSelection=True)
        mc.setParent('..') ; mc.setParent('..')
       
        # pane's column 3
        mc.frameLayout('optionFrame' , borderStyle='etchedIn' , collapsable=False , collapse=True ,
                                             labelVisible=False , marginWidth=2 , marginHeight=2)
        mc.scrollLayout()
        # Option and more UI elements comes here.....
        #
        #
        #
        #
        #------------------------------------------------------------------------------------------
       
        mc.setParent('mainColumn')
        # Button on the bottom
        mc.frameLayout('ConnectButton' , borderStyle='etchedIn' , collapsable=False , collapse=True,
                                            labelVisible=False , marginWidth=2 , marginHeight=2 , h=32)
        mc.button(l='CONNECT CONTROLS' , command="print'People you need to do something too ... ;)'")
       
        #-----------------------------------------------------------------------
        # set the size of the window
        mc.window('MainWindow' , edit=True, wh=(600, 400))
        # show Window
        mc.showWindow('MainWindow')
        #-----------------------------------------------------------------------





# NOTES: