Ejemplo n.º 1
0
    def _on_enable_fbi ( self, info ):
        """ Enables the FBI debugger.
        """
        if not self.fbi_enabled:
            self.fbi_enabled = True

            from facets.extra.helper.fbi import bp
            bp()
Ejemplo n.º 2
0
def view_application ( context, view, kind, handler, id, scrollable, args ):
    """ Creates a stand-alone application to display a specified facets UI View.

        Parameters
        ----------
        context : object or dictionary
            A single object or a dictionary of string/object pairs, whose facet
            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 facet
            attribute values.
        kind : string
            The type of user interface window to create. See the
            **facets.ui.ui_facets.AKind** facet 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 Facets 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'

    if not toolkit().is_application_running():
        app_info = AppInfo(
            context    = context,
            view       = view,
            kind       = kind,
            handler    = handler,
            id         = id,
            scrollable = scrollable,
            args       = args
        )

        facets_fbi = facets_env.fbi
        if facets_fbi != 0:
            try:
                from facets.extra.helper.fbi import bp

                condition = True
                if facets_fbi < 0:
                    condition = None

                bp( condition, context )
            except:
                pass

        name   = facets_env.init
        method = getattr( app_info, 'run_' + name, None )
        if method is None:
            raise FacetError(
                ("Unrecognized value for 'FACETS_INIT' environment variable: "
                 "'%s'") % name
            )

        return method()

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

#-- EOF ------------------------------------------------------------------------