def load_ui(path, parent=None, directory=None): """ Load a .ui file Parameters ---------- path : str Name of ui file to load parent : QObject Object to use as the parent of this widget Returns ------- w : QtGui.QWidget The new widget """ if directory is not None: full_path = os.path.join(directory, path) else: full_path = os.path.abspath(path) if not os.path.exists(full_path) and 'site-packages.zip' in full_path: # Workaround for Mac app full_path = os.path.join(full_path.replace('site-packages.zip', 'glue')) from glue.external.qt import load_ui return load_ui(full_path, parent, custom_widgets=CUSTOM_QWIDGETS)
def load_ui(path, parent=None, directory=None): """ Load a .ui file Parameters ---------- path : str Name of ui file to load parent : QObject Object to use as the parent of this widget Returns ------- w : QtGui.QWidget The new widget """ if directory is not None: full_path = os.path.join(directory, path) else: full_path = os.path.abspath(path) if not os.path.exists(full_path) and "site-packages.zip" in full_path: # Workaround for Mac app full_path = os.path.join(full_path.replace("site-packages.zip", "glue")) from glue.external.qt import load_ui return load_ui(full_path, parent, custom_widgets=CUSTOM_QWIDGETS)
def load_ui(path, parent=None): """ Load a UI file, given its name. This will first check if `path` exists, and if not it will assume it is the name of a ui file to search for in the global glue ui directory. Parameters ---------- name : str Name of ui file to load (without .ui extension) parent : QObject Object to use as the parent of this widget Returns ------- w : QtGui.QWidget The new widget """ if not os.path.exists(path): path = global_ui_path(path) from glue.external.qt import load_ui return load_ui(path, parent, custom_widgets=_custom_widgets())