Python pymel.core.deleteUI() Examples
The following are 12
code examples of pymel.core.deleteUI().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pymel.core
, or try the search function
.
Example #1
Source File: menu.py From mgear_dist with MIT License | 6 votes |
def create(menuId=menuId): """Create mGear main menu Args: menuId (str, optional): Main menu name Returns: str: main manu name """ if pm.menu(menuId, exists=True): pm.deleteUI(menuId) pm.menu(menuId, parent="MayaWindow", tearOff=True, allowOptionBoxes=True, label=menuId) return menuId
Example #2
Source File: dispatcher.py From spore with MIT License | 5 votes |
def remove_menu(self): """ remove the spore main menu """ self.logger.debug('Delete menu...') pm.deleteUI(self.menu)
Example #3
Source File: onionSkinRendererWindow.py From onionSkinRenderer with MIT License | 5 votes |
def deleteControl(self, control): if kDebugAll: print 'delete Control' if pm.workspaceControl(control, q=True, exists=True): pm.workspaceControl(control, e=True, close=True) pm.deleteUI(control, control=True) #
Example #4
Source File: ui.py From anima with MIT License | 5 votes |
def close(self, value): """closes the UI """ core.deleteUI(self.window_name, window=True) ### learning Scene Version
Example #5
Source File: selection_manager.py From anima with MIT License | 5 votes |
def delete_button(self): """delete rows """ pm.deleteUI(self.layout, layout=True)
Example #6
Source File: lightManager2016Below.py From PythonForMayaSamples with GNU General Public License v3.0 | 5 votes |
def __init__(self, dock=False): # First lets delete a dock if we have one so that we aren't creating more than we neec deleteDock() # Then if we have a UI called lightingManager, we'll delete it so that we can only have one instance of this # A try except is a very important part of programming when we don't want an error to stop our code # We first try to do something and if we fail, then we do something else. try: pm.deleteUI('lightingManager') except: logger.debug('No previous UI exists') # <=Maya2016: For Maya 2016 and below we always put it inside a QDialog and only dock at the end of this __init__ # Then we create a new dialog and give it the main maya window as its parent # we also store it as the parent for our current UI to be put inside parent = QtWidgets.QDialog(parent=getMayaMainWindow()) # We set its name so that we can find and delete it later # <=Maya2016: This also lets us attach the light manager to our dock control parent.setObjectName('lightingManager') # Then we set the title parent.setWindowTitle('Lighting Manager') # Finally we give it a layout dlgLayout = QtWidgets.QVBoxLayout(parent) # Now we are on to our actual widget # We've figured out our parent, so lets send that to the QWidgets initialization method super(LightingManager, self).__init__(parent=parent) # We call our buildUI method to construct our UI self.buildUI() # Now we can tell it to populate with widgets for every light self.populate() # We then add ourself to our parents layout self.parent().layout().addWidget(self) # Finally if we're not docked, then we show our parent parent.show() # <=Maya2016: For Maya 2016 and below we need to create the dock after we create our widget's parent window if dock: getDock()
Example #7
Source File: lightManager2016Below.py From PythonForMayaSamples with GNU General Public License v3.0 | 5 votes |
def deleteDock(name='LightingManagerDock'): """ A simple function to delete the given dock Args: name: the name of the dock """ # We use the dockControl to see if the dock exists if pm.dockControl(name, query=True, exists=True): # If it does we delete it pm.deleteUI(name)
Example #8
Source File: lightManager.py From PythonForMayaSamples with GNU General Public License v3.0 | 5 votes |
def deleteDock(name='LightingManagerDock'): """ A simple function to delete the given dock Args: name: the name of the dock """ # We use the workspaceControl to see if the dock exists if pm.workspaceControl(name, query=True, exists=True): # If it does we delete it pm.deleteUI(name)
Example #9
Source File: pyqt.py From mgear_core with MIT License | 4 votes |
def showDialog(dialog, dInst=True, dockable=False, *args): """ Show the defined dialog window Attributes: dialog (QDialog): The window to show. """ if dInst: try: for c in maya_main_window().children(): if isinstance(c, dialog): c.deleteLater() except Exception: pass # Create minimal dialog object # if versions.current() >= 20180000: # windw = dialog(maya_main_window()) # else: windw = dialog() # ensure clean workspace name if hasattr(windw, "toolName") and dockable: control = windw.toolName + "WorkspaceControl" if pm.workspaceControl(control, q=True, exists=True): pm.workspaceControl(control, e=True, close=True) pm.deleteUI(control, control=True) desktop = QtWidgets.QApplication.desktop() screen = desktop.screen() screen_center = screen.rect().center() windw_center = windw.rect().center() windw.move(screen_center - windw_center) # Delete the UI if errors occur to avoid causing winEvent # and event errors (in Maya 2014) try: if dockable: windw.show(dockable=True) else: windw.show() return windw except Exception: windw.deleteLater() traceback.print_exc()
Example #10
Source File: fix_bound_joint.py From anima with MIT License | 4 votes |
def UI(): """The UI of the script """ window_width = 153 window_height = 80 window_name = "oyFixBoundJoint_Window" if pm.window(window_name, ex=True): pm.deleteUI(window_name, window=True) window = pm.window( window_name, tlb=True, title="fixBoundJoint " + __version__, widthHeight=(window_width, window_height) ) pm.columnLayout("FBJ_columnLayout1", adj=True) pm.checkBox( "FBJ_checkBox1", l="Freeze transformations", al="left", v=1 ) pm.checkBox( "FBJ_checkBox2", l="Apply to children", al="left" ) pm.button( "FBJ_button1", l="Apply", c=get_check_box_states_and_run ) pm.setParent() window.show() window.setWidthHeight(val=(window_width, window_height))
Example #11
Source File: selection_manager.py From anima with MIT License | 4 votes |
def UI(): """The UI """ if pm.window("selectionManagerWindow", ex=True): pm.deleteUI("selectionManagerWindow", wnd=True) selection_manager_window = pm.window( 'selectionManagerWindow', wh=(300, 200), title=("Selection Manager %s" % __version__) ) form_layout1 = pm.formLayout("selectionManager_formLayout1", nd=100) with form_layout1: button1 = pm.button(l="Add selection to List") scroll_layout1 = pm.scrollLayout("selectionManager_scrollLayout1", cr=True) with scroll_layout1: pm.gridLayout( "selectionManager_gridLayout1", nc=1, cwh=(((17 * 4) + 204), 22), aec=False, cr=False ) pm.formLayout( form_layout1, edit=True, attachForm=[ (button1, "left", 0), (button1, "right", 0), (button1, "top", 0), (scroll_layout1, "left", 0), (scroll_layout1, "right", 0), (scroll_layout1, "bottom", 0) ], attachControl=[(scroll_layout1, "top", 0, button1)], attachNone=[(button1, "bottom")]) def create_row(parent): row = SelectionRowFactory.create_row(parent) row._draw() button1.setCommand(pm.Callback(create_row, scroll_layout1)) # restore rows from Maya scene for row in SelectionRowFactory.restore_rows(scroll_layout1): row._draw() pm.showWindow(selection_manager_window)
Example #12
Source File: lightManager.py From PythonForMayaSamples with GNU General Public License v3.0 | 4 votes |
def __init__(self, dock=False): # So first we check if we want this to be able to dock if dock: # If we should be able to dock, then we'll use this function to get the dock parent = getDock() else: # Otherwise, lets remove all instances of the dock incase it's already docked deleteDock() # Then if we have a UI called lightingManager, we'll delete it so that we can only have one instance of this # A try except is a very important part of programming when we don't want an error to stop our code # We first try to do something and if we fail, then we do something else. try: pm.deleteUI('lightingManager') except: logger.debug('No previous UI exists') # Then we create a new dialog and give it the main maya window as its parent # we also store it as the parent for our current UI to be put inside parent = QtWidgets.QDialog(parent=getMayaMainWindow()) # We set its name so that we can find and delete it later parent.setObjectName('lightingManager') # Then we set the title parent.setWindowTitle('Lighting Manager') # Finally we give it a layout dlgLayout = QtWidgets.QVBoxLayout(parent) # Now we are on to our actual widget # We've figured out our parent, so lets send that to the QWidgets initialization method super(LightingManager, self).__init__(parent=parent) # We call our buildUI method to construct our UI self.buildUI() # Now we can tell it to populate with widgets for every light self.populate() # We then add ourself to our parents layout self.parent().layout().addWidget(self) # Finally if we're not docked, then we show our parent if not dock: parent.show()