Load the ui file based on the module file location and the inputed class.
    
    :param      modulefile  | <str>
                inst        | <subclass of QWidget>
                uifile      | <str> || None
    
    :return     <QWidget>

def loadUi(modulefile, inst, uifile=None, theme='default', className=None):
    """
    Load the ui file based on the module file location and the inputed class.
    
    :param      modulefile  | <str>
                inst        | <subclass of QWidget>
                uifile      | <str> || None
    
    :return     <QWidget>
    """
    if className is None:
        className = inst.__class__.__name__

    import_qt(globals())
    
    currpath = QtCore.QDir.currentPath()
    
    # use compiled information vs. dynamic generation
    widget = None
    if USE_COMPILED:
        # find the root module
        def find_root_module(cls, name):
            if cls.__name__ == name:
                return cls.__module__.rpartition('.')[0]
            else:
                for base in cls.__bases__:
                    if not issubclass(base, QtGui.QWidget):
                        continue

                    out = find_root_module(base, name)
                    if out:
                        return out

        wrapper = QT_WRAPPER.lower()
        root_module = find_root_module(inst.__class__, className)
        if not root_module:
            root_module = inst.__module__.rpartition('.')[0]
        basename = className.lower()
        
        modname_a = '{0}.ui.{1}_{2}_{3}_ui'.format(root_module, basename, theme, wrapper)
        modname_b = '{0}.ui.{1}_{2}_ui'.format(root_module, basename, wrapper)
        modname_c = '{0}.ui.{1}_{2}_ui'.format(root_module, basename, theme)
        modname_d = '{0}.ui.{1}_ui'.format(root_module, basename)
        
        module = None
        for modname in (modname_a, modname_b, modname_c, modname_d):
            modname = modname.strip('.')
            logger.debug('Loading module: {0}...'.format(modname))
            try:
                __import__(modname)
                module = sys.modules[modname]
                break
            except StandardError:
                pass
        
        # successfully loaded a module
        if module:
            # load the module information
            cls = getattr(module, 'Ui_%s' % className, None)
            if not cls:
                for key in module.__dict__.keys():
                    if key.startswith('Ui_'):
                        cls = getattr(module, key)
                        break
            
            # generate the class information
            if cls:
                widget = cls()
                widget.setupUi(inst)
                inst.__dict__.update(widget.__dict__)
    
    if not widget:
        if not uifile:
            uifile = uiFile(modulefile, inst, theme, className=className)
        
        # normalize the path
        uifile = os.path.normpath(uifile)
        if os.path.exists(uifile):
            QtCore.QDir.setCurrent(os.path.dirname(uifile))
            widget = uic.loadUi(uifile, inst)
            QtCore.QDir.setCurrent(currpath)
    
    inst.addActions(findUiActions(inst))
    
    return widget