How to use the enaml.qt.qt_application.QtApplication function in enaml

To help you get started, we’ve selected a few enaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MatthieuDartiailh / HQCMeas / tests / __init__.py View on Github external
def setup_package():
    sys.path.append('..')
    QtApplication()
    print('')
    print(complete_line(__name__ + '__init__.py : setup_package()', '='))
    directory = os.path.dirname(__file__)
    util_path = os.path.join(directory, '..', 'hqc_meas', 'utils',
                             'preferences')
    def_path = os.path.join(util_path, 'default.ini')
    if os.path.isfile(def_path):
        os.rename(def_path, os.path.join(util_path, '_user_default.ini'))
github MatthieuDartiailh / HQCMeas / tests / utils / log / test_plugin.py View on Github external
def test_formatter(self):
        """ Test setting the formatter of a handler.

        """
        if not QtApplication.instance():
            QtApplication()

        core = self.workbench.get_plugin(u'enaml.workbench.core')
        model = PanelModel()
        handler = GuiHandler(model=model)
        core.invoke_command(u'hqc_meas.logging.add_handler',
                            {'id': 'ui', 'handler': handler, 'logger': 'test'},
                            self)

        formatter = logging.Formatter('toto : %(message)s')
        core.invoke_command(u'hqc_meas.logging.set_formatter',
                            {'formatter': formatter, 'handler_id': 'ui'},
                            self)

        logger = logging.getLogger('test')
        logger.info('test')
github nucleic / enaml / enaml / testing / fixtures.py View on Github external
def qt_app():
    """Make sure a QtApplication is active.

    """
    try:
        from enaml.qt.qt_application import QtApplication
    except ImportError:
        pytest.skip('No Qt binding found: %s' % format_exc())

    app = QtApplication.instance()
    if app is None:
        app = QtApplication()
        yield app
        app.stop()
    else:
        yield app
github BBN-Q / PyQLab / MeasFilters.py View on Github external
#Work around annoying problem with multiple class definitions
    from MeasFilters import DigitalDemod, Correlator, MeasFilterLibrary

    testFilter1 = DigitalDemod(label='M1')
    testFilter2 = DigitalDemod(label='M2')
    testFilter3 = Correlator(label='M3')
    testFilter4 = Correlator(label='M4')
    filterDict = {'M1':testFilter1, 'M2':testFilter2, 'M3':testFilter3,'M4':testFilter4}

    testLib = MeasFilterLibrary(libFile='MeasFilterLibrary.json', filterDict=filterDict)

    with enaml.imports():
        from MeasFiltersViews import MeasFilterManagerWindow

    app = QtApplication()
    view = MeasFilterManagerWindow(filterLib=testLib)
    view.show()

    app.start()
github nucleic / enaml / enaml / runner.py View on Github external
# Put the directory of the Enaml file first in the path so relative
    # imports can work.
    sys.path.insert(0, os.path.abspath(os.path.dirname(enaml_file)))
    # Bung in the command line arguments.
    sys.argv = [enaml_file] + script_argv
    with imports():
        exec(code, ns)

    # Make sure ^C keeps working
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    requested = options.component
    if requested in ns:
        from enaml.qt.qt_application import QtApplication
        app = QtApplication()
        window = ns[requested]()
        window.show()
        window.send_to_front()
        app.start()
    elif 'main' in ns:
        ns['main']()
    else:
        msg = "Could not find component '%s'" % options.component
        print(msg)
github nucleic / enaml / enaml / studio / ui / application_factory.py View on Github external
def __call__(self):
        """ Create the Application instance for the application.

        The default implementation of this method returns an instance
        of QtApplication.

        Returns
        -------
        result : Application
            The Application instance to use for the studio application.

        """
        from enaml.qt.qt_application import QtApplication
        return QtApplication()
github BBN-Q / PyQLab / Sweeps.py View on Github external
from instruments.MicrowaveSources import AgilentN5183A
    testSource1 = AgilentN5183A(label='TestSource1')
    testSource2 = AgilentN5183A(label='TestSource2')
    from Sweeps import Frequency, Power, SegmentNumWithCals, SweepLibrary

    sweepDict = {
        'TestSweep1': Frequency(label='TestSweep1', start=5, step=0.1, stop=6, instr=testSource1.label),
        'TestSweep2': Power(label='TestSweep2', start=-20, stop=0, numPoints=41, instr=testSource2.label),
        'SegWithCals': SegmentNumWithCals(label='SegWithCals', start=0, stop=20, numPoints=101, numCals=4)
    }
    sweepLib = SweepLibrary(possibleInstrs=[testSource1.label, testSource2.label], sweepDict=sweepDict)
    #sweepLib = SweepLibrary(libFile='Sweeps.json')

    with enaml.imports():
        from SweepsViews import SweepManagerWindow
    app = QtApplication()
    view = SweepManagerWindow(sweepLib=sweepLib)
    view.show()

    app.start()
github BBN-Q / PyQLab / instruments / InstrumentManager.py View on Github external
"instrDict": {label: instr
                              for label, instr in self.instrDict.items()},
                "version": self.version
            }


if __name__ == '__main__':

    from MicrowaveSources import AgilentN5183A
    instrLib = InstrumentLibrary(
        instrDict={'Agilent1': AgilentN5183A(label='Agilent1'),
                   'Agilent2': AgilentN5183A(label='Agilent2')})
    with enaml.imports():
        from InstrumentManagerView import InstrumentManagerWindow

    app = QtApplication()
    view = InstrumentManagerWindow(instrLib=instrLib)
    view.show()
    app.start()
github bluesky / databroker / dataportal / examples / pipeline / pipeline_demo.py View on Github external
def value_updated(self, changed):
        self.callback(self.value)


# hook up everything
# input
frame_source.event.connect(dm.append_data)
# first DataMuggler in to top of pipeline
mw.sig.connect(p1.sink_slot)
# p1 output -> p2 input
p1.source_signal.connect(p2.sink_slot)
# p2 output -> dm2
p2.source_signal.connect(dm.append_data)


app = QtApplication()

with enaml.imports():
    from pipeline import PipelineView

img_seq = DmImgSequence(data_muggler=dm, data_name='img')
cs_model = CrossSectionModel(data_muggler=dm, name='img',
                                        sliceable_data=img_seq)
roi_model = RegionOfInterestModel(callback=roi_callback)
from replay.model.fitting_model import FitController
multi_fit_controller = MultiFitController(valid_models=valid_models)
scalar_collection = ScalarCollection(data_muggler=dm,
                                     fit_controller=multi_fit_controller)
scalar_collection.scalar_models['count'].is_plotting = False
scalar_collection.scalar_models['T'].is_plotting = False
scalar_collection.scalar_models['x'].is_plotting = False
scalar_collection.scalar_models['y'].is_plotting = False
github BBN-Q / PyQLab / instruments / AWGs.py View on Github external
# local plugin registration to enable access by AWGs.plugin
plugins = find_plugins(AWG, verbose=False)
for plugin in plugins:
    if plugin not in AWGList:
        AWGList.append(plugin)
        if plugin.__name__ not in globals().keys():
            globals().update({plugin.__name__: plugin})
            print("Registered Plugin {}".format(plugin.__name__))

if __name__ == "__main__":
    with enaml.imports():
        from AWGsViews import AWGView

    awg = APS(label='BBNAPS1')
    app = QtApplication()
    view = AWGView(awg=awg)
    view.show()
    app.start()