예제 #1
0
def show(*agents):
    app = QtApplication()
    with imports():
        from e_Show import defaultView, showView, basicView#, LogWindow
    loc_chief=None
    for n, a in enumerate(agents):
        if hasattr(a, "view_window"):
            view=a.view_window
        else:
            view=defaultView(agent=a)
        if hasattr(a, "name"):
            view.name=a.name
        else:
            view.name="agent_{0}".format(n)
        if hasattr(a, "chief"):
            loc_chief=a.chief
        view.title=view.name
        view.show()
        if loc_chief is not None:
            if loc_chief.show_all or n==0:
                view.visible=True
    if loc_chief is None:
        view=basicView(title="Show Control", name="show_control")
    else:
        if hasattr(loc_chief, "view_window"):
            view=loc_chief.view_window
        else:
            view=showView(title="ShowControl", name="show_control", chief=loc_chief)
    view.show()

    app.start()
예제 #2
0
    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')

        app = QtApplication.instance()._qapp
        app.flush()
        app.processEvents()

        core.invoke_command(u'hqc_meas.logging.remove_handler', {'id': 'ui'},
                            self)

        assert_equal(model.text, 'toto : test\n')
예제 #3
0
파일: main.py 프로젝트: saluzi/enamlx
def main():
    logging.basicConfig(
        level='DEBUG',
        stream=sys.stdout,
        format='%(asctime)s %(levelname)-8s %(name)-15s %(message)s')

    try:
        import faulthandler
        faulthandler.enable()
    except ImportError:
        pass

    with enaml.imports():
        from view import Main

    app = QtApplication()
    profiler = cProfile.Profile()

    view = Main()
    view.show()

    # Start the application event loop
    profiler.enable()
    app.start()
    profiler.disable()
    profiler.print_stats('tottime')
예제 #4
0
def show(*agents):
    """a powerful showing function for any Atom object(s). Checks if object has a view_window property and otherwise uses a default.
    also provides a show control of the objects"""
    app = QtApplication()
    with imports():
        from chief_e import agentView, chiefView, basicView#, LogWindow
    loc_chief=None
    for n, a in enumerate(agents):
        if hasattr(a, "view_window"):
            view=a.view_window
        else:
            view=agentView(agent=a)
        if hasattr(a, "name"):
            view.name=a.name
        else:
            view.name="agent_{0}".format(n)
        if hasattr(a, "chief"):
            loc_chief=a.chief
        view.title=view.name
        view.show()
        if loc_chief is not None:
            if loc_chief.show_all or n==0:
                view.visible=True
    if loc_chief is None:
        view=basicView(title="Show Control", name="show_control")
    else:
        if hasattr(loc_chief, "view_window"):
            view=loc_chief.view_window
        else:
            view=chiefView(title="ShowControl", name="show_control", chief=loc_chief)
    view.show()
    app.start()
예제 #5
0
def show(obj):
    with imports():
        from e_Electron import AtomMain
    app = QtApplication()
    view = AtomMain(elect=obj)
    view.show()
    app.start()
예제 #6
0
def show(obj):
    with imports():
            from e_Electron import AtomMain
    app = QtApplication()
    view = AtomMain(elect=obj)
    view.show()
    app.start()
예제 #7
0
 def show(self):
    with imports():
        from e_Plotter import PlotMain
    app = QtApplication()
    view = PlotMain(plotr=self)
    view.show()
    app.start()
예제 #8
0
    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')

        app = QtApplication.instance()._qapp
        app.flush()
        app.processEvents()

        core.invoke_command(u'hqc_meas.logging.remove_handler',
                            {'id': 'ui'}, self)

        assert_equal(model.text, 'toto : test\n')
예제 #9
0
def main():
    app = QtApplication()
    model = Model()
    view = MainView(model=model)
    view.show()

    app.start()
예제 #10
0
def guiThread(myTextHolder):
    with enaml.imports():
        from validator_enaml import Main
    app = QtApplication()
    main = Main(textHolder=myTextHolder)
    main.show()
    app.start()
예제 #11
0
파일: replay.py 프로젝트: NSLS-II/replay
def main():
    app = QtApplication()
    parser = define_parser()
    args = parser.parse_args()
    params_dict = None
    logger.info('args: {}'.format(args))
    if args.live:
        params_dict = define_live_params()
    elif args.small_screen:
        params_dict = define_small_screen_params()
    loglevel = logging.WARNING
    if args.verbose:
        loglevel = logging.INFO
    elif args.debug:
        loglevel = logging.DEBUG

    replay.logger.setLevel(loglevel)
    replay.handler.setLevel(loglevel)

    # create and show the GUI
    ui = create(params_dict)
    ui.show()

    # show the most recent run by default
    try:
        ui.muxer_model.header = db[-1]
    except IndexError:
        pass
    except ValueError:
        pass

    app.start()
예제 #12
0
def show(a):
    app = QtApplication()
    with imports():
        from e_FundTemps import Main
    view = Main(instr=a)
    view.show()
    app.start()
예제 #13
0
def show(a):
    app = QtApplication()
    with imports():
        from e_FundTemps import Main
    view=Main(instr=a)
    view.show()
    app.start() 
예제 #14
0
def show(self):
    with imports():
        from e_Boss import AtomMain
    app = QtApplication()
    view = AtomMain(instr=self)
    view.show()
    app.start()
예제 #15
0
def show_boss(self, instr=None):
    with imports():
        from e_Boss import BossMain
    app = QtApplication()
    view = BossMain(myinstr=instr, boss=self)
    view.show()
    app.start()
예제 #16
0
def show_boss(self, instr=None):
    with imports():
        from e_Boss import BossMain
    app = QtApplication()
    view = BossMain(myinstr=instr, boss=self)
    view.show()
    app.start()
예제 #17
0
def show(self):
    with imports():
            from e_Boss import AtomMain
    app = QtApplication()
    view = AtomMain(instr=self)
    view.show()
    app.start()
예제 #18
0
def main():
    with enaml.imports():
        from football_matchday_summarizer.view import Main
    app = QtApplication()
    view = Main()
    view.show()
    app.start()
예제 #19
0
def main():
    # Parse command-line arguments.
    parser = argparse.ArgumentParser(description='Nemesis Model Builder', )
    parser.add_argument('model_path',
                        metavar='MODEL',
                        nargs='?',
                        help='model file to load')
    parser.add_argument('--data',
                        metavar='PATH',
                        dest='data_path',
                        help='data file to load')
    parser.add_argument('--debug', action='store_true', help=argparse.SUPPRESS)
    args = parser.parse_args()
    # At this point, we have valid arguments, so proceed with initialization.
    # Initialize the standard metrics and controls.
    init_stdlib()
    # Create the application object.
    app = QtApplication()
    init_error_handlers(debug=args.debug)
    if args.data_path:
        input_source = FileDataSource(path=args.data_path)
    else:
        input_source = None
    main_window = Main()
    controller = MainWindowController(
        input_source=input_source,
        debug_mode=args.debug,
        window=main_window,
    )
    if args.model_path:
        controller.load_file(args.model_path)
    main_window.show()
    app.start()
def create_app():
	""" Creates an app only if one doesn't already exist.

	"""
	global app
	if not app_exits():
		app = QtApplication()
		app.start()
예제 #21
0
def show_volume(volume_data):
    app = QtApplication()
    scene_members = {'bbox': VolumeBoundingBox()}
    viewer = VolumeViewer(volume_data=volume_data, histogram_bins=256,
                          scene_members=scene_members)
    win = VolumeViewerWindow(viewer=viewer)
    win.show()
    app.start()
예제 #22
0
 def show(self, inside_type=EBLPolygon, inner_type=EBLvert):
     """stand alone for showing polylist"""
     with imports():
         from EBL_enaml import EBMain
     app = QtApplication()
     view = EBMain(polyer=self, inside_type=inside_type, inner_type=inner_type)
     view.show()
     app.start()
예제 #23
0
def _launch(klass, experiment_type, root_folder=None):
    app = QtApplication()
    if root_folder is None:
        root_folder = get_config('DATA_ROOT')
    launcher = klass(root_folder=root_folder, experiment_type=experiment_type)
    view = LauncherView(launcher=launcher)
    view.show()
    app.start()
예제 #24
0
def show(a):
    from enaml import imports
    from enaml.qt.qt_application import QtApplication
    app = QtApplication()
    with imports():
        from taref.core.fundtemps_e import Main
    view=Main(instr=a)
    view.show()
    app.start()
def guiThread(myProp):
    with enaml.imports():
        from enaml_test2 import Main
    
    app = QtApplication()
    
    view = Main(myProp=myProp)
    view.show()
    app.start()
예제 #26
0
def guiThread(john):
    with enaml.imports():
        from person_view import PersonView

    app = QtApplication()

    view = PersonView(person=john)
    view.show()
    app.start()
예제 #27
0
def show(a):
    from enaml import imports
    from enaml.qt.qt_application import QtApplication
    app = QtApplication()
    with imports():
        from t_FundView_e import Main
    view=Main(vmodel=a)
    view.show()
    app.start()
예제 #28
0
def show_log():
    from enaml.qt.qt_application import QtApplication
    from enaml import imports
    app = QtApplication()
    with imports():
        from t_log_e import Main  # as LogWindow
    view = Main()
    view.show()
    app.start()
예제 #29
0
def show(a):
    from enaml import imports
    from enaml.qt.qt_application import QtApplication
    app = QtApplication()
    with imports():
        from t_FundView_e import Main
    view = Main(vmodel=a)
    view.show()
    app.start()
예제 #30
0
파일: gui.py 프로젝트: tropfcode/xrfgui
def run():
    app = QtApplication()
    logging.info('Program Started')
    logging.info('testing')
    data_list = DataListModel()
    plot = PlotModel()
    gui_run = Main(plot=plot, data_list=data_list)
    gui_run.show()
    app.start()
예제 #31
0
def main():
    pedidos = importa_pedidos_do_excel()
    controller = PedidosController(pedidos=pedidos.values())
    app = QtApplication()
    view = PedidosView(controller=controller)
    view.center_on_screen()
    view.show()
    view.maximize()
    app.start()
예제 #32
0
 def setUp(self):
     qt_app = QApplication.instance()
     if qt_app is None:
         qt_app = QApplication([])
     self.qt_app = qt_app
     enaml_app = QtApplication.instance()
     if enaml_app is None:
         enaml_app = QtApplication()
     self.enaml_app = enaml_app
     self.event_loop_helper = EventLoopHelper(qt_app=self.qt_app)
예제 #33
0
def main_gui():
    import enaml
    from enaml.qt.qt_application import QtApplication
    with enaml.imports():
        from .summarize_abr_gui import SummarizeABRGui

    app = QtApplication()
    view = SummarizeABRGui()
    view.show()
    app.start()
예제 #34
0
 def show(self, inside_type=EBLPolygon, inner_type=EBLvert):
     """stand alone for showing polylist"""
     with imports():
         from EBL_enaml import EBMain
     app = QtApplication()
     view = EBMain(polyer=self,
                   inside_type=inside_type,
                   inner_type=inner_type)
     view.show()
     app.start()
예제 #35
0
def main() -> None:
    with enaml.imports():
        App = import_view(".App")

    app = QtApplication()

    app_view = App.AppView()  # type: ignore
    app_view.show()

    app.start()
예제 #36
0
def main():

    app_state = ApplicationState()

    app = QtApplication()
    # Create a view and show it.
    view = AppWindow(app_state=app_state)
    view.show()

    app.start()
예제 #37
0
def test_main():

    app = QtApplication()

    controller = TestGraphController()
    view = Main(controller=controller)
    view.show()

    # Start the application event loop
    app.start()
예제 #38
0
def qt_app():
    """Make sure a QtApplication is active.
    """
    app = QtApplication.instance()
    if app is None:
        app = QtApplication()
        yield app
        app.stop()
    else:
        yield app
예제 #39
0
def run():
    app = QtApplication()
    with enaml.imports():
        from xray_vision.xrf.view.xrf_view import XrfGui

    view = XrfGui()
    view.xrf_model = XRF()

    view.show()
    app.start()
예제 #40
0
def test_replay_plotx_ploty():
    # insert a run header with one plotx and one ploty
    rs = mdsapi.insert_run_start(
        time=ttime.time(), beamline_id='replay testing', scan_id=1,
        custom={'plotx': 'Tsam', 'ploty': ['point_det']},
        beamline_config=mdsapi.insert_beamline_config({}, ttime.time()))
    temperature_ramp.run(rs)
    # plotting replay in live mode with plotx and ploty should have the
    # following state after a few seconds of execution:
    # replay.
    app = QtApplication()
    ui = replay.create(replay.define_live_params())
    ui.title = 'testing replay with plotx and one value of ploty'
    ui.show()
    app.timed_call(4000, app.stop)
    app.start()
    try:
        # the x axis should be 'plotx'
        assert ui.scalar_collection.x == 'Tsam'
        # there should only be 1 scalar model currently plotting
        assert len([scalar_model for scalar_model
                    in ui.scalar_collection.scalar_models.values()
                    if scalar_model.is_plotting]) == 1
        # the x axis should not be the index
        assert not ui.scalar_collection.x_is_index
    except AssertionError:
        # gotta destroy the app or it will cause cascading errors
        ui.close()
        app.destroy()
        raise

    ui.close()
    app.destroy()
예제 #41
0
파일: runner.py 프로젝트: pickmoment/enaml
def main():
    usage = 'usage: %prog [options] enaml_file [script arguments]'
    parser = optparse.OptionParser(usage=usage, description=__doc__)
    parser.allow_interspersed_args = False
    parser.add_option('-c',
                      '--component',
                      default='Main',
                      help='The component to view')

    options, args = parser.parse_args()

    if len(args) == 0:
        print('No .enaml file specified')
        sys.exit()
    else:
        enaml_file = args[0]
        script_argv = args[1:]

    enaml_code = read_source(enaml_file)

    # Parse and compile the Enaml source into a code object
    ast = parse(enaml_code, filename=enaml_file)
    code = EnamlCompiler.compile(ast, enaml_file)

    # Create a proper module in which to execute the compiled code so
    # that exceptions get reported with better meaning
    module = types.ModuleType('__main__')
    module.__file__ = os.path.abspath(enaml_file)
    sys.modules['__main__'] = module
    ns = module.__dict__

    # 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)
예제 #42
0
def main():
    with enaml.imports():
        from welcome_header import Main

    app = QtApplication()

    view = Main()
    view.show()

    # Start the application event loop
    app.start()
예제 #43
0
def run_demo():
    with enaml.imports():
        from mplot_demo_docks import Main

    app = QtApplication()

    view = Main(custom_title="Matplotlib demo", mplot_style="darkish")
    view.show()

    # Start the application event loop
    app.start()
예제 #44
0
def run():
    with enaml.imports():
        from vtk_extract_view import Main

    app = QtApplication()

    view = Main(custom_title='VTK Geometry Extract Example')
    view.show()

    # Start the application event loop
    app.start()
def run():
    with enaml.imports():
        from vtk_canvas_docks_model import Main

    app = QtApplication()

    view = Main(custom_title='VTK Example')
    view.show()

    # Start the application event loop
    app.start()
예제 #46
0
def run():
    with enaml.imports():
        from vtk_surface_demo import Main

    app = QtApplication()

    view = Main(data=[dsin(), zdata(), dtx(), dtv(), nonedatarandom()])
    view.show()

    # Start the application event loop
    app.start()
예제 #47
0
def run():
    app = QtApplication()
    with enaml.imports():
        from xray_vision.xrf.view.file_view import FileGui

    view = FileGui()
    view.xrf_model1 = XRF()
    view.xrf_model2 = XRF()

    view.show()
    app.start()
예제 #48
0
def main():
    with enaml.imports():
        from mpl_canvas import Main

    app = QtApplication()

    view = Main()
    view.show() 

    # Start the application event loop
    app.start()
예제 #49
0
def main():
    with enaml.imports():
        from spiral_plot import SpiralWindow

    app = QtApplication()
    model = SpiralModel()
    window = SpiralWindow(model=model)
    window.show()

    # Start the application event loop
    app.start()
예제 #50
0
def main():
    with enaml.imports():
        from patient_list_page import Main

    app = QtApplication()

    view = Main()
    view.show()

    # Start the application event loop
    app.start()
예제 #51
0
def main():
    with enaml.imports():
        from horizontal import Main

    app = QtApplication()

    view = Main()
    view.show() 

    # Start the application event loop
    app.start()
예제 #52
0
def main():
    with enaml.imports():
        from examples.tutorial.hello_world.hello_world_view import Main

    app = QtApplication()

    view = Main()
    view.show()

    # Start the application event loop
    app.start()
예제 #53
0
def main():
    with enaml.imports():
        from hello_world_view import Main

    app = QtApplication()

    view = Main(message="Hello World, from Python!")
    view.show()

    # Start the application event loop
    app.start()
예제 #54
0
def run_demo():
    with enaml.imports():
        from datetime_field import Main

    app = QtApplication()

    view = Main()
    view.show()

    # Start the application event loop
    app.start()
예제 #55
0
def main():
    with enaml.imports():
        from hbox_spacing import Main

    app = QtApplication()

    view = Main()
    view.show() 

    # Start the application event loop
    app.start()
예제 #56
0
def run():
    with enaml.imports():
        from vtk_grid_view import Main

    app = QtApplication()

    view = Main(custom_title='VTK Geometry Extract Example')
    view.show()

    # Start the application event loop
    app.start()