Created
July 27, 2015 11:42
-
-
Save atvKumar/c5bcdb2e138bd773d315 to your computer and use it in GitHub Desktop.
Boiler Plate Code for Windows GUI under PyMel/Python/Maya
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------- | |
# Boiler Plate Code for Windows | |
# By : Kumaran | |
import pymel.core as pm | |
class UI(pm.uitypes.Window): | |
_TITLE = "mkWindow" | |
_LAYOUT = "mkLayout" | |
_DOCKCONTROL = "mkDockCtrl" | |
dockControl = None | |
def __new__(cls): | |
if pm.window(cls._TITLE, exists=True): | |
pm.deleteUI(cls._TITLE) | |
if(pm.dockControl(cls._DOCKCONTROL, ex=1)): | |
pm.deleteUI(cls._DOCKCONTROL, control=1) | |
self = pm.window(cls._TITLE, title=cls._TITLE) | |
return pm.uitypes.Window.__new__(cls, self) | |
def __init__(self): | |
form = pm.formLayout(self._LAYOUT) | |
self.show() | |
def ui_makeDockable(self): | |
''' make the window dockable ''' | |
# skip if already dockable | |
if(self.dockControl): | |
pm.mel.eval('warning "%s"' % "Window already dockable!") | |
return | |
# create dockControl | |
self.dockControl = pm.dockControl(self._DOCKCONTROL, l=self, content=self, | |
area='left', allowedArea=['left', 'right']) | |
# | |
#------------------------------------------------------------------------------- | |
UI() | |
#UI().ui_makeDockable() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment