MayaQWidgetDockableMixin allowedArea?

So I have my class inheriting from MayaQWidgetDockableMixin, however when I try to set the allowedArea I get an error.
I know I’m missing something here.


from PySide import QtGui
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin

class App(MayaQWidgetDockableMixin,QtGui.QDialog):
....
ui = App()
ui.show(dockable=True, floating=False, area='right', allowedArea='right', width=200, height=300, x=300, y=600)


Error:


// Error: 'MayaQDockWidget' object has no attribute 'setAllowedArea'
#     ui.setDockableParameters(dockable=True, floating=False, area='right', allowedArea='right', width=200, height=300, x=300, y=600)
#   File "C:\Program Files\Autodesk\Maya2015\Python\lib\site-packages\maya\app\general\mayaMixin.py", line 299, in setDockableParameters
#     dockWidget.setAllowedArea(areaValue)
# AttributeError: 'MayaQDockWidget' object has no attribute 'setAllowedArea' //

If I leave out the allowedArea it works fine.

1 Like

Hmmm… I see a function on QDockWidget called “setAllowedAreas”. I suspect a mistake in site-packages\maya\app\general\mayaMixin.py. Either they meant to type “setAllowedArea” instead of “setAllowedArea”, or they meant to create a function called “setAllowedArea” in the MayaQDockWidget class.

Since you are subclassing from MayaQWidgetDockableMixin, maybe you could add your own “setAllowedArea” function?

Edit: On second thought, I’m not 100% sure that would work. Trying to read through the code with all the multiple inheritance and stuff. Anyways, let us know what you try, what works and what doesn’t.

That was it. Line 299 in mayaMixin.py has a typo.
It should be :
dockWidget.setAllowedAreas(areaValue)
instead of:
dockWidget.setAllowedArea(areaValue)

Argghh!
Yea, I’ll have to SubClass the MayaQWidgetDockableMixin and override the method with the fixed typo.

Thanks!