theodox / mGui

Python module for cleaner maya GUI layout syntax
MIT License
123 stars 23 forks source link

Adding a new ModalWindow class. #57

Closed bob-white closed 7 years ago

bob-white commented 7 years ago

Not sure if this fixes #56 or not, but it does provide a potential alternative. This behaves identically to the BindingWindow, except it blocks input to all other windows.

This allows us to define a ModalWindow, just like any other Window class, and lets us bypass cmds.layoutDialog

For example: from maya import cmds from mGui import gui, forms

def test(*_, **__): cmds.polySphere()

with gui.ModalWindow() as win: with forms.FillForm() as form: btn = gui.Button() btn.command += test

win.show()

theodox commented 7 years ago

@bob-white what about moving this into the QT module instead? Putting it in core introduces a potential version-breaking dependency, I wanted to isolate those into an optional module

bob-white commented 7 years ago

Good call. Realized I need to add some other methods as well.

theodox commented 7 years ago

While you're at it, it would be kindly to add a version switch that handled QT4/QT5 issues.... jus' sayin' :)

bob-white commented 7 years ago

Ha just noticed the other comment. You want I should add that to QTextField as well? Do we want to worry about PySide vs PyQt? Or should we just stick with supporting PySide(2) for now?

bob-white commented 7 years ago

Added support for PySide2 for now, if we want to stretch this to handle PyQt, it might be best to adopt something along the lines of https://github.com/mottosso/Qt.py, to have a single adapter layer.

theodox commented 7 years ago

Agreed, the audience for this is QT-averse (like me!)

bob-white commented 7 years ago

I was testing this a bit more. Turns out while it does make the window modal, it doesn't actually block. Which means it does avoid the problems in #56, but doesn't really work as a replacement for layoutDialog

theodox commented 7 years ago

Modal but non-blocking sounds ... problematic...

theodox commented 7 years ago

@bob-white, maybe we should make a new QTPy branch and push that over that way?

bob-white commented 7 years ago

This is superseded by #68