edifice.App

class edifice.App(component, inspector=False, create_application=True, application_name=None, mount_into_window=True)[source]

Bases: object

The main application object.

To start the application, call the start method:

App(MyRootComponent()).start()

If you just want to create a widget (that you’ll integrate with an existing codebase), call the export_widgets method:

widget = App(MyRootComponent()).export_widgets()

This widget can then be plugged into the rest of your application, and there’s no need to manage the rendering of the widget – state changes will trigger automatic re-render without any intervention.

Parameters
  • component (Component) – the root component of the application. If it is not an instance of Window or RootComponent, a Window will be created with the passed in component as a child.

  • inspector – whether or not to run an instance of the Edifice Inspector alongside the main app. Defaults to False

  • create_application – (default True) whether or not to create an instance of QApplication. Usually you want to use the default setting. However, if the QApplication is already created (e.g. in a test suite or if you just want Edifice to make a widget to plug into an existing Qt application), you can set this to False.

  • application_name – the Qt application name to set when creating a new QApplication. This option is only relevant if create_application is True.

  • mount_into_window – (default True) whether or not to mount a window-less component into a window by default. If the passed in component is not part of any window, leaving this flag on will put the component in a window. Set this to False if you just want the App to output a widget.

Methods

export_widgets()

Exports the Qt widgets underlying the Edifice Component.

set_stylesheet(stylesheet)

Adds a global stylesheet for the app.

start()