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()
Beispiel #2
0
 def show(self):
    with imports():
        from e_Plotter import PlotMain
    app = QtApplication()
    view = PlotMain(plotr=self)
    view.show()
    app.start()
Beispiel #3
0
def show(a):
    app = QtApplication()
    with imports():
        from e_FundTemps import Main
    view = Main(instr=a)
    view.show()
    app.start()
Beispiel #4
0
def main():
    parser = argparse.ArgumentParser("abr_loop")
    add_default_arguments(parser)
    parser.add_argument('dirnames', nargs='*')
    parser.add_argument('--list', action='store_true')
    options = parse_args(parser)
    parser = options['parser']

    unprocessed = []
    for dirname in options['dirnames']:
        unprocessed.extend(parser.find_unprocessed(dirname))

    if options['list']:
        counts = Counter(f for f, _ in unprocessed)
        for filename, n in counts.items():
            filename = os.path.basename(filename)
            print(f'{filename} ({n})')

    else:
        app = QtApplication()
        presenter = SerialWaveformPresenter(parser=parser,
                                            unprocessed=unprocessed)
        view = SerialWindow(presenter=presenter)
        view.show()
        app.start()
        app.stop()
Beispiel #5
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')
def main():
    """ Generate documentation for all enaml examples requesting autodoc.

    Looks in enaml/examples for all enaml files, then looks for the line:
    << auto-doc >>

    If the line appears in the script, generate an RST and PNG for the example.
    """
    app = QtApplication()
    docs_path = os.path.dirname(__file__)
    base_path = '../../../examples'
    base_path = os.path.realpath(os.path.join(docs_path, base_path))

    enaml_cache_dir = os.path.join(docs_path, '__enamlcache__')

    for dirname, dirnames, filenames in os.walk(base_path):
        files = [
            os.path.join(dirname, f) for f in filenames if f.endswith('.enaml')
        ]

        for fname in files:
            with open(fname, 'rb') as fid:
                data = fid.read()
            if '<< autodoc-me >>' in data.splitlines():
                try:
                    generate_example_doc(app, docs_path, fname)
                except KeyboardInterrupt:
                    shutil.rmtree(enaml_cache_dir)
                    return
    shutil.rmtree(enaml_cache_dir)
def main(white_list):
    """ Generate documentation for all enaml examples requesting autodoc.

    Looks in enaml/examples for all enaml files, then looks for the line:
    << auto-doc >>

    If the line appears in the script, generate an RST and PNG for the example.
    """
    app = QtApplication()
    docs_path = os.path.dirname(__file__)
    base_path = '../../../examples'
    base_path = os.path.realpath(os.path.join(docs_path, base_path))

    # Find all the files in the examples directory with a .enaml extension
    # that contain the pragma '<< autodoc-me >>', and generate .rst files for
    # them.
    for dirname, dirnames, filenames in os.walk(base_path):
        files = [
            os.path.join(dirname, f) for f in filenames if f.endswith('.enaml')
        ]
        if white_list:
            files = [
                f for f in files if any([f.endswith(w) for w in white_list])
            ]
        for fname in files:
            with open(fname, 'rb') as fid:
                data = fid.read()
            if b'<< autodoc-me >>' in data.splitlines():
                generate_example_doc(docs_path, fname)
Beispiel #8
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()
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()
Beispiel #10
0
def guiThread(myTextHolder):
    with enaml.imports():
        from validator_enaml import Main
    app = QtApplication()
    main = Main(textHolder=myTextHolder)
    main.show()
    app.start()
Beispiel #11
0
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')
def show(obj):
    with imports():
        from e_Electron import AtomMain
    app = QtApplication()
    view = AtomMain(elect=obj)
    view.show()
    app.start()
Beispiel #13
0
def show_simple_view(view, toolkit='qt', description=''):
    """ Display a simple view to the screen in the local process.

    Parameters
    ----------
    view : Object
        The top level Object to use as the view.

    toolkit : string, optional
        The toolkit backend to use to display the view. Currently
        supported values are 'qt' and 'wx'. The default is 'qt'.
        Note that not all functionality is available on Wx.

    description : string, optional
        An optional description to give to the session.

    """
    f = lambda: view
    if toolkit == 'qt':
        from enaml.qt.qt_application import QtApplication
        app = QtApplication([simple_session('main', description, f)])
    elif toolkit == 'wx':
        from enaml.wx.wx_application import WxApplication
        app = WxApplication([simple_session('main', description, f)])
    else:
        raise ValueError('Unknown toolkit `%s`' % toolkit)
    app.start_session('main')
    app.start()
    return app
Beispiel #14
0
def show(self):
    with imports():
        from e_Boss import AtomMain
    app = QtApplication()
    view = AtomMain(instr=self)
    view.show()
    app.start()
Beispiel #15
0
def main():
    import enaml
    from enaml.qt.qt_application import QtApplication

    from cochleogram.presenter import Presenter

    with enaml.imports():
        from cochleogram.gui import CochleagramWindow

    parser = argparse.ArgumentParser("Cochleogram helper")
    parser.add_argument("path", nargs='?')
    parser.add_argument("--piece")
    args = parser.parse_args()

    app = QtApplication()
    config = get_config()

    if args.path is not None:
        pieces = list_pieces(args.path) if args.piece is None else [args.piece]
        presenters = [Presenter(Piece.from_path(args.path, p)) for p in pieces]
    else:
        presenters = []

    current_path = config['DEFAULT']['current_path']
    view = CochleagramWindow(presenters=presenters, current_path=current_path)
    view.show()
    app.start()
    app.stop()
    config['DEFAULT']['current_path'] = str(Path(view.current_path).absolute())
    write_config(config)
Beispiel #16
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()
Beispiel #17
0
def main():
    with enaml.imports():
        from football_matchday_summarizer.view import Main
    app = QtApplication()
    view = Main()
    view.show()
    app.start()
Beispiel #18
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()
def guiThread(myProp):
    with enaml.imports():
        from enaml_test2 import Main
    
    app = QtApplication()
    
    view = Main(myProp=myProp)
    view.show()
    app.start()
Beispiel #20
0
def main(**kwargs):
    app = QtApplication()
    qt5reactor.install()
    view = ViewerWindow(filename=kwargs.get('file', '-'),
                        frameless=kwargs.get('frameless', False))
    view.protocol = ViewerProtocol(view)
    view.show()
    app.deferred_call(lambda: StandardIO(view.protocol))
    app.start()
Beispiel #21
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()
Beispiel #22
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()
Beispiel #23
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()
Beispiel #24
0
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()
Beispiel #25
0
def guiThread(john):
    with enaml.imports():
        from person_view import PersonView

    app = QtApplication()

    view = PersonView(person=john)
    view.show()
    app.start()
 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()
def test_main():

    app = QtApplication()

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

    # Start the application event loop
    app.start()
Beispiel #28
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()
Beispiel #29
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)
Beispiel #30
0
def main():

    app_state = ApplicationState()

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

    app.start()