Code Monkey home page Code Monkey logo

Comments (7)

fredrikaverpil avatar fredrikaverpil commented on May 28, 2024

It uses PySide.QUiTools indirectly through the load_ui function of Qt.py.

So for example, if you're running the boilerplate in Maya version <= 2016 or Nuke (any version), those will use PySide. For those software/versions, Qt.py will pick that up.

Basically, look into Qt.py and its load_ui function: https://github.com/mottosso/Qt.py
This function will load the .ui files regardless of which Qt binding is available (PySide, PyQt4, PySide2 or PyQt5).

from pyvfx-boilerplate.

sschoellhammer avatar sschoellhammer commented on May 28, 2024

Thanks for the quick reply!
I was hoping to find a way to get common functionality between pyside and qt from Qt.py :
form_class, base_class = uic.loadUiType( uiFile )
but I guess it's not supported - just loading the widget itself via load_ui isn't enough for me :/

from pyvfx-boilerplate.

fredrikaverpil avatar fredrikaverpil commented on May 28, 2024

No, that's not supported exactly like that. But you can define a base class with a little bit of extra work around load_ui. I've provided two examples here on that: https://github.com/mottosso/Qt.py/tree/master/examples/load_ui

I personally prefer this approach:

def setup_ui(uifile, base_instance=None):
    """Load a Qt Designer .ui file and returns an instance of the user interface
    Args:
        uifile (str): Absolute path to .ui file
        base_instance (QWidget): The widget into which UI widgets are loaded
    Returns:
        QWidget: the base instance
    """
    ui = QtCompat.load_ui(uifile)  # Qt.py mapped function
    if not base_instance:
        return ui
    else:
        for member in dir(ui):
            if not member.startswith('__') and \
               member is not 'staticMetaObject':
                setattr(base_instance, member, getattr(ui, member))
        return ui

Call the function (example):

setup_ui('my_ui.ui', base_instance=self)

from pyvfx-boilerplate.

sschoellhammer avatar sschoellhammer commented on May 28, 2024

from pyvfx-boilerplate.

sschoellhammer avatar sschoellhammer commented on May 28, 2024

from pyvfx-boilerplate.

fredrikaverpil avatar fredrikaverpil commented on May 28, 2024

Cool!

from pyvfx-boilerplate.

sschoellhammer avatar sschoellhammer commented on May 28, 2024

from pyvfx-boilerplate.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.