python类window()的实例源码

zbw_randomSelection.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def randomSelectionUI(*args):
    if cmds.window("win", exists = True):
        cmds.deleteUI("win")

    widgets["win"] = cmds.window("win", w=280, h=75, t="zbw_randomSelection")

    widgets["mainCLO"] = cmds.columnLayout()
    widgets["text"] = cmds.text("What percent of selection do you want to keep?")
    widgets["keepIFG"] = cmds.intFieldGrp(l=" % to keep:", v1=50, h=40, cw = ([1, 65], [2, 50]), cal = ([1,"left"], [2, "left"]))
    widgets["text2"] = cmds.text("Random: each obj has % chance to be removed")
    widgets["text3"] = cmds.text("Precise: exact num removed, but randomly chosen")
    cmds.separator(h=10)
    widgets["typeRBG"] = cmds.radioButtonGrp(l="Type:", l1 = "Random Remove", l2 = "Precise Remove", nrb = 2, sl = 1, cw = ([1, 30], [2,120], [3, 120], [4, 50]), cal = ([1, "left"], [2,"left"], [3, "left"], [4, "left"]))
    widgets["but"] = cmds.button(l="Reselect", w=280, h=40, bgc = (.6, .8, .6), c = doSel)

    cmds.window(widgets["win"], e=True, w=280, h=75)
    cmds.showWindow(widgets["win"])
core.py 文件源码 项目:maya-pulse 作者: bohdon 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def deleteInstances(cls):
        """
        Delete existing instances of this window
        """
        result = False
        # close and delete an existing workspace control
        if cmds.workspaceControl(cls.getWorkspaceControlName(), q=True, ex=True):
            cmds.workspaceControl(cls.getWorkspaceControlName(), e=True, close=True)
            result = True
        if cmds.workspaceControl(cls.getWorkspaceControlName(), q=True, ex=True):
            cmds.deleteUI(cls.getWorkspaceControlName(), control=True)
            result = True
        if cmds.window(cls.OBJECT_NAME, q=True, ex=True):
            cmds.deleteUI(cls.OBJECT_NAME, window=True)
            result = True
        return result
convert_color_code.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _create_ui(self):
        u"""UI???"""
        safe_delete_window(self._WINDOW_NAME)
        win = cmds.window(self._WINDOW_NAME, t="Convert Color Code", mb=True, w=480, h=128)
        cmds.menu(l="Option")
        cmds.menuItem(l="ColorEditor", c=self.get_color_from_editor)
        cmds.columnLayout(adj=True, rs=2)
        self.color_code_field = cmds.textFieldButtonGrp(l="Color code", bl="Convert", bc=self._convert)
        self.decimal_point_field = cmds.intFieldGrp(l="Decimal point", nf=1, v1=2)
        self.result_field = cmds.textFieldGrp(l="Result")

        cmds.setParent("..")

        cmds.columnLayout(adj=True)
        self.color_preview = cmds.text(l="", h=24)
        cmds.setParent("..")
        cmds.showWindow(win)
zbw_findScript.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def findScriptUI(*args):

    if cmds.window("findScript", exists = True):
        cmds.deleteUI("findScript")

    widgets["win"] = cmds.window("findScript", t="zbw_findPath", w=300, h=200)
    widgets["mainCLO"] = cmds.columnLayout()

    cmds.separator(h=10)
    widgets["textTx"] = cmds.text(l="Will search your active python paths. \nNo need for suffix (.py or .mel)\nNo wildcards(*). Just string, 3 chars min", al="left")
    cmds.separator(h=20)
    widgets["nameTFG"] = cmds.textFieldGrp(l="search for:", cw = [(1, 75), (2,200)], cal = [(1, "left"),(2, "right")])
    cmds.separator(h=20)
    widgets["searchBut"] = cmds.button(l="Search python paths!", w=300, h=50, bgc=(0,.6, 0), c=searchPaths)
    cmds.separator(h=20)

    widgets["resultTxt"] = cmds.textFieldGrp(l="results:", ed=False, w=300, cw = [(1, 75), (2,200)], bgc = (0,0,0) , cal = [(1, "left"),(2, "right")])

    cmds.showWindow(widgets["win"])
zbw_scriptList.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def getScriptsUI(*args):

    if cmds.window("thisWin", exists = True):
        cmds.deleteUI("thisWin")

    widgets["win"] = cmds.window("thisWin", w=300, h=200)
    widgets["mainFLO"] = cmds.formLayout()

    widgets["list"] = cmds.textScrollList(nr=10, w=300, dcc = executeCommand)

    cmds.formLayout(widgets["mainFLO"], e=1, af = [(widgets["list"], "left", 0), (widgets["list"], "top", 0), (widgets["list"], "bottom", 30), (widgets["list"], "right", 0)])

    widgets["button"] = cmds.button(l="Refresh List!", w=300, h= 30, bgc = (.8, .6, .3), c= getScripts)
    cmds.formLayout(widgets["mainFLO"], e=1, af = [(widgets["button"], "left", 0), (widgets["button"], "right", 0), (widgets["button"], "bottom", 0)])

    cmds.showWindow(widgets["win"])

#populate the list with the contents of the path
zbw_scriptList.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def executeCommand(*args):
    item = cmds.textScrollList(widgets["list"], q=True, si=True)[0]
    #### here we should reference a dictionary of scriptName: code to execute script
    #### load our file from userprefs(?)

    # with open("/Bluearc/HOME/CHRLX/zwillie/Desktop/jsonTest.json" ,"w") as f:
    # json.dump(animals, f, sort_keys = True, indent=4)

    # with open("/Bluearc/HOME/CHRLX/zwillie/Desktop/jsonTest.json", "r") as f:
    #     data  = json.load(f)

    #if there is an item or items that AREN'T in the dictionary as keys, throw a warning and ask for the correct input--
    #separate function to add stuff to our dictionary and save it
    #BETTER - color code the item in the list as red and when clicked, bring up a window to enter the call for the script (and add to dict and save)

    #if the key exists (aka the script name), then execute the code (value) next to it

    #print out in the script editor (warning) which command your trying to run.
    #catch key errors - i.e. this script:command pair isn't registered in the fileName.json

    if (item.rpartition(".")[2] == "mel"):
        mel.eval(item.rpartition(".")[0])

    elif (item.rpartition(".")[2] == "py"):
        exec(pythonRun[item.rpartition(".")[0]])
zbw_shadingTransfer.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def shadingTransferUI(*args):
    if cmds.window("win", exists=True):
        cmds.deleteUI("win")

    widgets["win"] = cmds.window("win", t="zbw_shadingTransfer", w=200, h=100, s=False)
    widgets["mainCLO"] = cmds.columnLayout()

    cmds.text(l="1. Select the source object (poly/nurbs)", al="left")
    cmds.text(l="2. Select the target object(s)", al="left")
    cmds.text(l="Note: deleteHistory on the transferUV\nwill try to avoid deleting deformers.\nNo promises:)", al="left")
    cmds.separator(h=10)
    widgets["shdBut"] = cmds.button(l="Copy Shaders to targets!", w=200, h=40, bgc=(.4, .7, .4), c=partial(getSelection, "copyShader"))
    cmds.separator(h=10)
    widgets["uvBut"] = cmds.button(l="Transfer UV's to targets!", w=200, h=40, bgc=(.7, .7, .5), c=partial(getSelection, "transferUV"))
    widgets["xferCBG"] = cmds.checkBoxGrp(l="Delete history after transfer?", v1=0, cal=[(1, "left"), (2,"left")], cw=[(1, 150), (2, 50)])
    cmds.window(widgets["win"], e=True, w=200, h=100)
    cmds.showWindow(widgets["win"])
zbw_snap.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def snapUI():
    """simple snap UI for snapping"""

    if cmds.window("snapWin", exists=True):
        cmds.deleteUI("snapWin", window=True)
        cmds.windowPref("snapWin", remove=True)

    widgets["win"] = cmds.window("snapWin", t="zbw_snap", w=210, h=100, rtf=True)
    widgets["mainCLO"] = cmds.columnLayout(w=210, h=100)
    cmds.text("Select the target object(s),\nthen the object(s) you want to snap", al="center", w=210)
    cmds.separator(h=5, style="single")
    widgets["cbg"] = cmds.checkBoxGrp(l="Options: ", ncb=2, v1=1, v2=1, l1="Translate", l2="Rotate", cal=[(1,"left"),(2,"left"), (3,"left")], cw=[(1,50),(2,75),(3,75)])
    widgets["avgRBG"] = cmds.radioButtonGrp(nrb=2, l1="Snap all to first", l2="Snap last to avg", cal=[(1,"left"),(2,"left"),(3,"left")], cw=[(1,100),(2,100)],sl=1)
    widgets["rpCB"] = cmds.checkBox(l="Use Rotate Pivot To Query Position?", v=1)
    widgets["snapPivCB"] = cmds.checkBox(l="Snap via pivot? (vs. translate value)", v=1)
    cmds.separator(h=5, style="single")
    widgets["snapButton"] = cmds.button(l="Snap obj(s)!", w=210, h=40, bgc=(.6,.8,.6), c=partial(snapIt, False))
    widgets["snapPivButton"] = cmds.button(l="Snap pivot!", w=210, h=20, bgc=(.8,.6,.6), c=partial(snapIt, True))

    cmds.window(widgets["win"], e=True, w=5, h=5)
    cmds.showWindow(widgets["win"])
zbw_selectionBuffer.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def selectionUI(*args):
    #window stuff, two buttons
    if cmds.window("selWin", exists=True):
        cmds.deleteUI("selWin")

    widgets["win"] = cmds.window("selWin", t="zbw_selectionBuffer", s=False)
    widgets["mainCLO"] = cmds.columnLayout(bgc = (.8, .8, .8))

    widgets["getBut"] = cmds.button(l="Grab Selection", bgc = (.5, .5, .9), w=200, h=50, c=grabSel)
    cmds.separator(h=5)
    widgets["checkBut"] = cmds.button(l="Check Stored (in scipt ed.)", bgc = (.5, .5, .5), w=200, h=20, en=False, c=checkSel)
    cmds.separator(h=10)
    widgets["restoreBut"] = cmds.button(l="Restore Selection", bgc = (.5, .8, .5), w=200, h=50, c=restoreSel)

    cmds.window(widgets["win"], e=True, w=200, h=135)
    cmds.showWindow(widgets["win"])
zbw_jointRadius.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def jointRadiusUI(*args):
    if cmds.window("jntWin", exists=True):
        cmds.deleteUI("jntWin")

    widgets["win"] = cmds.window("jntWin", t="zbw_jointRadius", w=200, h=90, s=False)
    widgets["clo"] = cmds.columnLayout(rs=10)

    widgets["slider"] = cmds.floatSliderGrp(l="radius", min=0.05, max=2, field=True, fieldMinValue=0.01,
                                            fieldMaxValue=2, precision=2, sliderStep=0.1, value=0.5,
                                            cw=([1, 40], [2, 45], [3, 115]),
                                            cal=([1, "left"], [2, "left"], [3, "left"]))
    # radio button group, all or selected
    widgets["rbg"] = cmds.radioButtonGrp(nrb=2, l1="all", l2="selected", cw=([1, 50], [1, 50]), sl=1)
    widgets["but"] = cmds.button(l="Set Radius", w=205, h=50, bgc=(.5, .8, .5), c=adjustRadius)

    cmds.window(widgets["win"], e=True, w=200, h=90)
    cmds.showWindow(widgets["win"])
zbw_messageMapper.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def zbw_mmChangeConnectAttrUI(base, attr, obj, *args):
    if (cmds.window('zbw_mmChangeAttrUI', exists=True)):
        cmds.deleteUI('zbw_mmChangeAttrUI', window=True)
        cmds.windowPref('zbw_mmChangeAttrUI', remove=True)
    window=cmds.window('zbw_mmChangeAttrUI', widthHeight=(400,80), title='zbw_messageMapper_changeAttrName')
    cmds.columnLayout()
    #show old attr name
    cmds.text("old attribute name: " + attr)
    #asks for the new attr name
    cmds.textFieldGrp("zbw_mmChangeAttrTFG", l="new attr name (just attr name)")
    #button to do it (pass along attr, obj)
    cmds.button("zbw_mmChangeAttrB", l="change attr!", c=partial(zbw_mmChangeConnectAttr, base, attr, obj))
    cmds.showWindow(window)
    #force window to size
    cmds.window('zbw_mmChangeAttrUI', e=True, widthHeight = (400,80))
    pass
zbw_messageMapper.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def zbw_mmChangeConnectObjUI(base, attr, obj, *args):
    if (cmds.window('zbw_mmChangeObjUI', exists=True)):
        cmds.deleteUI('zbw_mmChangeObjUI', window=True)
        cmds.windowPref('zbw_mmChangeObjUI', remove=True)
    window=cmds.window('zbw_mmChangeObjUI', widthHeight=(400,85), title='zbw_messageMapper_changeObjName')
    cmds.columnLayout()
    #show old attr name
    cmds.text("base attribute name: " + attr)
    cmds.text("old connected obj name: " + obj)
    #asks for the new attr name
    cmds.textFieldButtonGrp("zbw_mmChangeObjTFBG", l="select new obj: ", bl="get", bc=partial(zbw_mmAddTarget, "zbw_mmChangeObjTFBG"))
    #button to do it (pass along attr, obj)
    cmds.button("zbw_mmChangeObjB", l="change obj!", c=partial(zbw_mmChangeConnectObj, base, attr, obj))
    cmds.showWindow(window)
    #force window to size
    cmds.window('zbw_mmChangeObjUI', e=True, widthHeight = (420,85))
zbw_modelSequence.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def modelSequenceUI(*args):
    if (cmds.window("modSeq", exists=True)):
        cmds.deleteUI("modSeq")

    widgets["win"] = cmds.window("modSeq", w = 300, h = 220, t = "zbw_modelSequence")
    widgets["mainCLO"] = cmds.columnLayout(w = 300,h = 220)

    cmds.separator(h=10)
    cmds.text("Select ONE object to be duplicated \nThis will duplicate it for frames selected and group", al="left")
    cmds.separator(h=20)

    #textFieldGRP - name of objs
    widgets["sufTFG"] = cmds.textFieldGrp(l="Sequence Suffix:", cw = [(1, 100), (2,200)], cal = [(1, "left"),(2, "right")])
    #radioButtonGrp - timeslider or frame range
    widgets["frmRBG"] = cmds.radioButtonGrp(l="Get Frames From:", nrb=2, sl=2, l1="Time Slider", l2="Frame Range", cw = [(1, 120), (2,80), (3,80)], cal = [(1, "left"),(2, "left")], cc=enableFR)
    #textFieldGrp - framerange (enable)
    widgets["frmRngIFG"] = cmds.intFieldGrp(l="Range:", nf=2, en=True, v1=0, v2 = 9, cw = [(1, 120), (2,80), (3,80)], cal = [(1, "left"),(2, "left")])
    #int = by frame step
    widgets["stepIFG"] = cmds.intFieldGrp(l="Step By (frames):", v1 = 1, cw = [(1, 120), (2,80)], cal = [(1, "left"),(2, "right")])

    cmds.separator(h=30)
    widgets["doBut"] = cmds.button(l="Create duplicates of objects!", w= 300, h=40, bgc = (0,.8, 0), c=getValues)


    cmds.showWindow(widgets["win"])
zbw_makeFollicle.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def follicleUI(*args):
    """UI for the script"""

    if cmds.window("folWin", exists=True):
        cmds.deleteUI("folWin")

    widgets["win"] = cmds.window("folWin", t="zbw_makeFollicle", w=300, h=100)
    widgets["mainCLO"] = cmds.columnLayout()
    # widgets["polyFrame"] = cmds.frameLayout(l="Polygon Vert(s) Follicle")
    # widgets["polyCLO"] = cmds.columnLayout()
    widgets["text"] = cmds.text("Select one or two vertices (2 will get avg position) and run")
    widgets["nameTFG"] = cmds.textFieldGrp(l="FollicleName:", cal=([1, "left"],[2,"left"]), cw=([1,100],[2,200]), tx="follicle")
    cmds.separator(h=10)
    widgets["button"] = cmds.button(w=300, h=50, bgc=(0.6,.8,.6), l="Add follicle to vert(s)", c=getUV)
    # cmds.setParent(widgets["mainCLO"])
    # widgets["nurbsFrame"] = cmds.frameLayout(l="Nurbs select")
    cmds.showWindow(widgets["win"])
    cmds.window(widgets["win"], e=True, w=300, h=100)
#-------could also select edit point????
#-------multiple selection and average uv position? Orrrr option to create multiple UV's, one on each vertex
#-------grab an edge and convert to 2 verts and get average. . .
#-------have option for distributed (select 2 verts and number of follicles, spread that num between the two uv positions)
zbw_transformBuffer.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setValues(*args):
    """sets the values from window on all selected objs for appropriate channels"""

    sel = cmds.ls(sl=True)

    attrs = cmds.checkBoxGrp(widgets["transCBG"], q=True, va3=True)
    trans = attrs[0]
    rots = attrs[1]
    scls = attrs[2]

    for obj in sel:
        if cmds.objectType(obj)=="transform":
            if trans:
                t = cmds.floatFieldGrp(widgets["trnFFG"], q=True, v=True)
                cmds.setAttr("{}.translate".format(obj), t[0], t[1], t[2])
            if rots:
                r = cmds.floatFieldGrp(widgets["rotFFG"], q=True, v=True)
                cmds.setAttr("{}.rotate".format(obj), r[0],r[1], r[2])
            if scls:
                s = cmds.floatFieldGrp(widgets["sclFFG"], q=True, v=True)
                cmds.setAttr("{}.scale".format(obj), s[0], s[1], s[2])
zbw_dupeSwap.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def dupeSwapUI():
    """UI for script"""

    if cmds.window("dupeWin", exists=True):
        cmds.deleteUI("dupeWin")

    cmds.window("dupeWin", t="zbw_dupeSwap", w=250, h=100)
    cmds.columnLayout("dupeCLO")
    cmds.text("Select the initial object. then select the", al="center", w=250)
    cmds.text("duplicates and press button", al="center", w=250)
    cmds.separator(h=5, style ="single")
    cmds.radioButtonGrp("inputsRBG", l="inputs:", nrb=3, l1="none", l2="connect", l3="duplicate", cw=[(1, 50), (2,47), (3,63), (4,40)], cal=[(1,"left"), (2,"left"), (3,"left"), (4,"left")], sl=1)
    cmds.separator(h=5, style ="single")

    cmds.button("dupeButton", l="Swap Elements", w=250, h=50, bgc=(.6, .8,.6), c=dupeIt)

    cmds.showWindow("dupeWin")
    cmds.window("dupeWin", e=True, w=250, h=100)
zbw_ipMover.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def changeValue(attr, slider, *args):

    value = cmds.floatSliderGrp(slider, q=True, v=True)
    cmds.setAttr(attr, value)

# def focusToCamera():

    #get camera from focus window
    # panel = cmds.getPanel(wf=True)
    # cam = cmds.modelEditor(panel, q=True, camera=True)

#----------get camera from focus . . .
#----------have camera list to select from . . .

# (coverageX)
# (coverageY)
ml_utilities.py 文件源码 项目:ml_tools 作者: morganloomis 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def finish(self):
        '''
        Finalize the UI
        '''

        mc.setParent(self.form)

        frame = mc.frameLayout(labelVisible=False)
        mc.helpLine()

        mc.formLayout( self.form, edit=True,
                       attachForm=((self.column, 'top', 0), (self.column, 'left', 0),
                                   (self.column, 'right', 0), (frame, 'left', 0),
                                   (frame, 'bottom', 0), (frame, 'right', 0)),
                       attachNone=((self.column, 'bottom'), (frame, 'top')) )

        mc.showWindow(self.name)
        mc.window(self.name, edit=True, width=self.width, height=self.height)
ml_utilities.py 文件源码 项目:ml_tools 作者: morganloomis 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def about(self, *args):
        '''
        This pops up a window which shows the revision number of the current script.
        '''

        text='by Morgan Loomis\n\n'
        try:
            __import__(self.module)
            module = sys.modules[self.module]
            text = text+'Revision: '+str(module.__revision__)+'\n'
        except StandardError:
            pass
        try:
            text = text+'ml_utilities Rev: '+str(__revision__)+'\n'
        except StandardError:
            pass

        mc.confirmDialog(title=self.name, message=text, button='Close')
tweener.py 文件源码 项目:PythonForMayaSamples 作者: dgovil 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def show(self):
        # First we check if a window of this name already exists.
        # This prevents us having many tweener windows when we just want one
        if cmds.window(self.windowName, query=True, exists=True):
            # If another window of the same name exists, we close it by deleting it
            cmds.deleteUI(self.windowName)

        # Now we create a window using our name
        cmds.window(self.windowName)

        # Now we call our buildUI method to build out the insides of the UI
        self.buildUI()

        # Finally we must actually show the window
        cmds.showWindow()
reusableUI.py 文件源码 项目:PythonForMayaSamples 作者: dgovil 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def show(self):
        if cmds.window(self.windowName, query=True, exists=True):
            self.close()

        cmds.window(self.windowName)
        self.buildUI()
        cmds.showWindow()
menu.py 文件源码 项目:cmt 作者: chadmv 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def about():
    """Displays the CMT About dialog."""
    name = 'cmt_about'
    if cmds.window(name, exists=True):
        cmds.deleteUI(name, window=True)
    if cmds.windowPref(name, exists=True):
        cmds.windowPref(name, remove=True)
    window = cmds.window(name, title='About CMT', widthHeight=(600, 500), sizeable=False)
    form = cmds.formLayout(nd=100)
    text = cmds.scrollField(editable=False, wordWrap=True, text=cmt.__doc__.strip())
    button = cmds.button(label='Documentation', command='import cmt.menu; cmt.menu.documentation()')
    margin = 8
    cmds.formLayout(form, e=True,
                    attachForm=(
                        (text, 'top', margin),
                        (text, 'right', margin),
                        (text, 'left', margin),
                        (text, 'bottom', 40),
                        (button, 'right', margin),
                        (button, 'left', margin),
                        (button, 'bottom', margin),
                    ),
                    attachControl=(
                        (button, 'top', 2, text)
                    ))
    cmds.showWindow(window)
__init__.py 文件源码 项目:medic 作者: sol-ansano-kim 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def Show():
    global MedicUIInstance

    if MedicUIInstance:
        cmds.showWindow(window.MainWindow.Name)

    else:
        if cmds.window(window.MainWindow.Name, q=True, ex=True):
            cmds.deleteUI(window.MainWindow.Name)

        MedicUIInstance = window.MainWindow(functions.getMayaMainWindow())
        MedicUIInstance.show()
core.py 文件源码 项目:maya-pulse 作者: bohdon 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def createAndShow(cls):
        cls.deleteInstances()
        window = cls()
        window.show()
        return window
core.py 文件源码 项目:maya-pulse 作者: bohdon 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def exists(cls):
        """
        Return True if an instance of this window exists
        """
        result = False
        if cmds.workspaceControl(cls.getWorkspaceControlName(), q=True, ex=True):
            result = True
        if cmds.workspaceControl(cls.getWorkspaceControlName(), q=True, ex=True):
            result = True
        if cmds.window(cls.OBJECT_NAME, q=True, ex=True):
            result = True
        return result
check_layout.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
        u"""initialize"""
        self.window = None
        self.text_field = None
        self.text_scroll = None
check_layout.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def show_ui(self):
        u"""Window???"""
        if cmds.window(self._WINDOW_NAME, exists=True):
            cmds.deleteUI(self._WINDOW_NAME)

        self.window = cmds.window(self._WINDOW_NAME,
                                  t=self._WINDOW_TITLE,
                                  width=340,
                                  maximizeButton=False, minimizeButton=False)

        form = cmds.formLayout()
        field_group = cmds.columnLayout(adj=True, cal="center", rs=self._MARGIN)
        cmds.text(u"""???????????????????????????????
????????????????????????????""", al="left")
        self.text_scroll = cmds.textScrollList(append=self.get_windows(), ams=False, dcc=self.check_execute)
        self.text_field = cmds.textFieldGrp(l=u"????", ad2=2, cl2=["left", "left"], cw=[1, 60])
        cmds.setParent("..")

        button_group = cmds.columnLayout(adj=True, cal="center")
        cmds.button(l="Check", c=self.check_execute)
        cmds.setParent("..")

        cmds.formLayout(form, e=True,
                        attachForm=[(field_group, "top", self._MARGIN),
                                    (field_group, "left", self._MARGIN),
                                    (field_group, "right", self._MARGIN),
                                    (button_group, "bottom", self._MARGIN),
                                    (button_group, "left", self._MARGIN),
                                    (button_group, "right", self._MARGIN)],
                        attachControl=[(button_group, "top", self._MARGIN, field_group)])
        cmds.setParent("..")

        cmds.showWindow(self.window)
ui_utility.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def safe_delete_window(win, *args):
    u"""????????????????"""
    if cmds.window(win, q=True, ex=True):
        cmds.deleteUI(win)
recent_files.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def show(self):
        u"""Window???"""
        self.safe_delete_ui(RecentFileWindow._WINDOW_NAME)

        cmds.window(RecentFileWindow._WINDOW_NAME, title=RecentFileWindow._WINDOW_TITLE)
        cmds.frameLayout(label="RecentFiles",
                         marginWidth=6,
                         marginHeight=6,
                         borderStyle="etchedIn")

        for file_path, file_type in get_recent_files().items():
            cmds.button(label=file_path, c=partial(self._open_file, file_path, file_type))
        cmds.showWindow(RecentFileWindow._WINDOW_NAME)
recent_files.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def safe_delete_ui(self, ui_name):
        u"""?????UI??????????????"""
        if cmds.window(ui_name, exists=True):
            cmds.deleteUI(ui_name)


问题


面经


文章

微信
公众号

扫码关注公众号