Example #1
0
def is_ui_running():
    """ Returns True if the UI event loop is running.
    """
    from engine_manager import options
    if options.offscreen:
        return True
    elif ETSConfig.toolkit == 'wx':
        return guisupport.is_event_loop_running_wx()
    elif ETSConfig.toolkit == 'qt4':
        return guisupport.is_event_loop_running_qt4()
    else:
        return False
Example #2
0
def is_ui_running():
    """ Returns True if the UI event loop is running.
    """
    from engine_manager import options

    if options.offscreen:
        return True
    elif ETSConfig.toolkit == "wx":
        return guisupport.is_event_loop_running_wx()
    elif ETSConfig.toolkit == "qt4":
        return guisupport.is_event_loop_running_qt4()
    else:
        return False
def view_application ( context, view, kind, handler, id, scrollable, args ):
    """ Creates a stand-alone PyQt application to display a specified traits UI
        View.

    Parameters
    ----------
    context : object or dictionary
        A single object or a dictionary of string/object pairs, whose trait
        attributes are to be edited. If not specified, the current object is
        used.
    view : view object
        A View object that defines a user interface for editing trait attribute
        values.
    kind : string
        The type of user interface window to create. See the
        **enthought.traits.ui.view.kind_trait** trait for values and
        their meanings. If *kind* is unspecified or None, the **kind**
        attribute of the View object is used.
    handler : Handler object
        A handler object used for event handling in the dialog box. If
        None, the default handler for Traits UI is used.
    scrollable : Boolean
        Indicates whether the dialog box should be scrollable. When set to
        True, scroll bars appear on the dialog box if it is not large enough
        to display all of the items in the view at one time.


    """
    if (kind == 'panel') or ((kind is None) and (view.kind == 'panel')):
        kind = 'modal'

    app = QtGui.QApplication.instance()
    if app is None or not is_event_loop_running_qt4(app):
        return ViewApplication( context, view, kind, handler, id,
                                scrollable, args ).ui.result

    return view.ui( context,
                    kind       = kind,
                    handler    = handler,
                    id         = id,
                    scrollable = scrollable,
                    args       = args ).result