Esempio n. 1
0
def launch_application(opts, config):
    qtpyvcp.OPTIONS.update(opts)
    qtpyvcp.CONFIG.update(config)

    hal_comp = hal.component('qtpyvcp')

    LOG.debug('Loading data plugings')
    loadDataPlugins(config['data_plugins'])
    log_time('done loading data plugins')

    LOG.debug('Initializing app')
    app = _initialize_object_from_dict(config['application'])
    log_time('done initializing app')

    LOG.debug('Loading dialogs')
    loadDialogs(config['dialogs'])
    log_time('done loading dialogs')

    LOG.debug('Loading windows')
    loadWindows(config['windows'])
    log_time('done loading windows')

    LOG.debug('Initializing widgets')
    app.initialiseWidgets()
    log_time('done initializing widgets')

    hal_comp.ready()

    # load any post GUI hal file
    postgui_halfile = INFO.getPostguiHalfile()
    if postgui_halfile is not "":
        if not os.path.exists(postgui_halfile):
            raise IOError('The specified POSTGUI_HALFILE does not exist: %s' %
                          postgui_halfile)

        ini_path = INFO.INI_FILE

        LOG.info('Loading POSTGUI_HALFILE: %s', postgui_halfile)

        res = os.spawnvp(os.P_WAIT, "halcmd",
                         ["halcmd", "-i", ini_path, "-f", postgui_halfile])

        if res:
            raise SystemExit("Failed to load POSTGUI_HALFILE with error: %s" %
                             res)

    sys.exit(app.exec_())
Esempio n. 2
0
    print(
        "ERROR: You must use the PyQt5 bindings in order to use the custom \n"
        "widgets in QtDesigner.")
    sys.exit()

os.environ['DESIGNER'] = 'true'

from qtpyvcp.utilities.logger import initBaseLogger
LOG = initBaseLogger("qtpyvcp-designer",
                     log_level=os.getenv('QTPYVCP_LOG_LEVEL', 'ERROR'),
                     log_file=os.getenv(
                         'QTPYVCP_LOG_FILE',
                         os.path.expanduser('~/qtpyvcp-designer.log')))

from qtpyvcp import CONFIG, DEFAULT_CONFIG_FILE
os.environ['VCP_CONFIG_FILES'] = os.getenv('VCP_CONFIG_FILES', '') + \
                                 ':' + DEFAULT_CONFIG_FILE

from qtpyvcp.utilities.config_loader import load_config_files_from_env
CONFIG.update(load_config_files_from_env())

from qtpyvcp.plugins import loadDataPlugins
loadDataPlugins(CONFIG['data_plugins'])

from qtpyvcp.widgets.form_widgets.designer_plugins import *
from qtpyvcp.widgets.button_widgets.designer_plugins import *
from qtpyvcp.widgets.display_widgets.designer_plugins import *
from qtpyvcp.widgets.input_widgets.designer_plugins import *
from qtpyvcp.widgets.hal_widgets.designer_plugins import *
from qtpyvcp.widgets.containers.designer_plugins import *