本文整理匯總了Python中pymel.core.deleteUI方法的典型用法代碼示例。如果您正苦於以下問題:Python core.deleteUI方法的具體用法?Python core.deleteUI怎麽用?Python core.deleteUI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymel.core
的用法示例。
在下文中一共展示了core.deleteUI方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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
示例2: remove_menu
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
def remove_menu(self):
""" remove the spore main menu """
self.logger.debug('Delete menu...')
pm.deleteUI(self.menu)
示例3: deleteControl
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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)
#
示例4: close
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
def close(self, value):
"""closes the UI
"""
core.deleteUI(self.window_name, window=True)
### learning Scene Version
示例5: delete_button
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
def delete_button(self):
"""delete rows
"""
pm.deleteUI(self.layout, layout=True)
示例6: __init__
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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()
示例7: deleteDock
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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)
示例8: deleteDock
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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)
示例9: showDialog
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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()
示例10: UI
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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))
示例11: UI
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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)
示例12: __init__
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import deleteUI [as 別名]
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()