Exemple #1
0
def main():
    log.initialize(log_level='debug')
    app = Application()
    w = XTermWindow()
    w.extraParams = ["-e", "ipython"]
    w.start()
    w.show()
    app.exec_()
Exemple #2
0
def main():
    log.initialize(log_level='debug')
    app = Application()
    w = XTermWindow()
    w.extraParams = ["-e", "ipython"]
    w.start()
    w.show()
    app.exec_()
Exemple #3
0
def Application(argv=None, **properties):
    """Returns a QApplication.

    If the process has initialized before a QApplication it returns the
    existing instance, otherwise it creates a new one.

    When a QApplication is created it takes argv into account. If argv is
    None (default), it take arguments from :attr:`sys.argv`.

    If argv is given and a QApplication already exists, argv will have no
    effect.

    :param argv: optional arguments to QApplication. If the QApplication is
                 already initialized, argv will have no effect.

    Example::

        from qarbon.external.qt import QtGui
        from qarbon.qt.gui.application import Application

        app = Application()
        label = QtGui.QLabel("Hello, world!")
        label.show()
        app.exec_()

    :param properties: currently unused
    :return: the QApplication
    :rtype: QtGui.QApplication"""

    init_logging = properties.get('init_logging', False)
    if init_logging:
        log.initialize()

    from qarbon.external.qt import QtGui
    app = QtGui.QApplication.instance()
    if app is None:
        if argv is None:
            from sys import argv
        app = QtGui.QApplication(argv)
    elif argv:
        log.info("QApplication already initialized. argv will have no "
                 "effect")
    return app
Exemple #4
0
# ----------------------------------------------------------------------------
# This file is part of qarbon (http://qarbon.rtfd.org/)
#
# Copyright (c) 2013 European Synchrotron Radiation Facility, Grenoble, France
#
# Distributed under the terms of the GNU Lesser General Public License,
# either version 3 of the License, or (at your option) any later version.
# See LICENSE.txt for more info.
# ----------------------------------------------------------------------------

from qarbon import log

log.initialize(log_level="debug")
from qarbon.qt.gui.x11 import XTermWidget
from qarbon.qt.gui.application import Application

log.debug("first message")
Exemple #5
0
def main():
    level = os.environ.get("QARBON_DESIGNER_LOG_LEVEL", "WARNING")
    log.initialize(log_level=level)
    plugins = getPlugins()
    globals().update(plugins)
def main():
    level = os.environ.get("QARBON_DESIGNER_LOG_LEVEL", "WARNING")
    log.initialize(log_level=level)
    plugins = getPlugins()
    globals().update(plugins)
Exemple #7
0
def Application(argv=None, **kwargs):
    """Returns a QApplication.

    If the process has initialized before a QApplication it returns the
    existing instance, otherwise it creates a new one.

    When a QApplication is created it takes argv into account. If argv is
    None (default), it take arguments from :attr:`sys.argv`.

    If argv is given and a QApplication already exists, argv will have no
    effect.

    :param argv: optional arguments to QApplication. If the QApplication is
                 already initialized, argv will have no effect.

    Example::

        from qarbon.external.qt import QtGui
        from qarbon.qt.gui.application import Application

        app = Application()
        label = QtGui.QLabel("Hello, world!")
        label.show()
        app.exec_()

    :param kwargs: currently unused
    :return: the QApplication
    :rtype: QtGui.QApplication"""

    # It is important to initialize logging before Qt because Qt might
    # fire some log messages
    init_logging = kwargs.get('init_logging', False)
    if init_logging:
        log.initialize()

    from qarbon.external.qt import QtGui
    app = QtGui.QApplication.instance()
    if app is None:
        if argv is None:
            from sys import argv
        app = QtGui.QApplication(argv)

        init_application = kwargs.get('init_application', True)
        init_organization = kwargs.get('init_organization', True)
        if init_application:
            app_name = kwargs.get('application_name', config.APPLICATION_NAME)
            app.setApplicationName(app_name)
            app_version = kwargs.get('application_version',
                                     config.APPLICATION_VERSION)
            app.setApplicationVersion(app_version)
        if init_organization:
            org_name = kwargs.get('organization_name',
                                  config.ORGANIZATION_NAME)
            app.setOrganizationName(org_name)
            org_domain = kwargs.get('organization_domain',
                                    config.ORGANIZATION_DOMAIN)
            app.setOrganizationDomain(org_domain)

    elif argv:
        log.info("QApplication already initialized. argv will have no "
                 "effect")
    return app
Exemple #8
0
# ----------------------------------------------------------------------------
# This file is part of qarbon (http://qarbon.rtfd.org/)
#
# Copyright (c) 2013 European Synchrotron Radiation Facility, Grenoble, France
#
# Distributed under the terms of the GNU Lesser General Public License,
# either version 3 of the License, or (at your option) any later version.
# See LICENSE.txt for more info.
# ----------------------------------------------------------------------------

from qarbon import log
log.initialize(log_level="debug")
from qarbon.qt.gui.x11 import XTermWidget
from qarbon.qt.gui.application import Application

log.debug("first message")
Exemple #9
0
def Application(argv=None, **kwargs):
    """Returns a QApplication.

    If the process has initialized before a QApplication it returns the
    existing instance, otherwise it creates a new one.

    When a QApplication is created it takes argv into account. If argv is
    None (default), it take arguments from :attr:`sys.argv`.

    If argv is given and a QApplication already exists, argv will have no
    effect.

    :param argv: optional arguments to QApplication. If the QApplication is
                 already initialized, argv will have no effect.

    Example::

        from qarbon.external.qt import QtGui
        from qarbon.qt.gui.application import Application

        app = Application()
        label = QtGui.QLabel("Hello, world!")
        label.show()
        app.exec_()

    :param kwargs: currently unused
    :return: the QApplication
    :rtype: QtGui.QApplication"""

    # It is important to initialize logging before Qt because Qt might
    # fire some log messages
    init_logging = kwargs.get('init_logging', False)
    if init_logging:
        log.initialize()

    from qarbon.external.qt import QtGui
    app = QtGui.QApplication.instance()
    if app is None:
        if argv is None:
            from sys import argv
        app = QtGui.QApplication(argv)

        init_application = kwargs.get('init_application', True)
        init_organization = kwargs.get('init_organization', True)
        if init_application:
            app_name = kwargs.get('application_name', config.APPLICATION_NAME)
            app.setApplicationName(app_name)
            app_version = kwargs.get('application_version',
                                     config.APPLICATION_VERSION)
            app.setApplicationVersion(app_version)
        if init_organization:
            org_name = kwargs.get('organization_name',
                                  config.ORGANIZATION_NAME)
            app.setOrganizationName(org_name)
            org_domain = kwargs.get('organization_domain',
                                    config.ORGANIZATION_DOMAIN)
            app.setOrganizationDomain(org_domain)

    elif argv:
        log.info("QApplication already initialized. argv will have no "
                 "effect")
    return app