Exemplo n.º 1
0
def make_server(logger=None,
                basedir='.',
                numthreads=5,
                host='localhost',
                port=9909,
                use_opencv=False):

    if logger is None:
        logger = log.get_logger("ipg", null=True)
    ev_quit = threading.Event()

    if use_opencv:
        from ginga import trcalc
        try:
            trcalc.use('opencv')
        except Exception as e:
            logger.warning("Error using opencv: %s" % str(e))

    thread_pool = Task.ThreadPool(numthreads, logger, ev_quit=ev_quit)

    base_url = "http://%s:%d/app" % (host, port)
    app = Widgets.Application(logger=logger,
                              base_url=base_url,
                              host=host,
                              port=port)

    factory = ViewerFactory(logger, basedir, app, thread_pool)

    server = WebServer(app, thread_pool, factory, host=host, port=port)

    return server
Exemplo n.º 2
0
def main(params):

    ginga_logger = log.get_logger("ginga", options=params)

    if params.use_opencv:
        from ginga import trcalc
        try:
            trcalc.use('opencv')
        except Exception as ex:
            ginga_logger.warning("Error using OpenCL: {}".format(ex))

    if params.use_opencl:
        from ginga import trcalc
        try:
            trcalc.use('opencl')
        except Exception as ex:
            ginga_logger.warning("Error using OpenCL: {}".format(ex))

    app = Widgets.Application(logger=ginga_logger,
                              host=params.host,
                              port=params.port)

    #  create top level window
    window = app.make_window("Validate", wid='Validate')

    # our own viewer object, customized with methods (see above)
    ValidateGui(logging.getLogger('daomop'), window)

    try:
        app.start()

    except KeyboardInterrupt:
        ginga_logger.info("Terminating viewer...")
        window.close()
Exemplo n.º 3
0
    def __init__(self, host='localhost', port=9909, logger=None, numthreads=5):
        self.tornado_app = None
        self.viewers = {}
        self.host = host
        self.port = port

        if logger is None:
            logger = log.get_logger("nbinteract_server", null=True)
        self.logger = logger

        self.thread_pool = Task.ThreadPool(numthreads, logger)
        self.app = Widgets.Application(logger=self.logger,
                                       base_url=self.base_url)
Exemplo n.º 4
0
def main(options, args):

    logger = log.get_logger("example2", options=options)

    if options.use_opencv:
        from ginga import trcalc
        try:
            trcalc.use('opencv')
        except Exception as e:
            logger.warning("Error using OpenCv: %s" % str(e))

    if options.use_opencl:
        from ginga import trcalc
        try:
            trcalc.use('opencl')
        except Exception as e:
            logger.warning("Error using OpenCL: %s" % str(e))

    base_url = "http://%s:%d/app" % (options.host, options.port)

    # establish our widget application
    app = Widgets.Application(logger=logger,
                              host=options.host,
                              port=options.port)

    #  create top level window
    window = app.make_window("Ginga web example2")

    # our own viewer object, customized with methods (see above)
    viewer = FitsViewer(logger, window)
    #server.add_callback('shutdown', viewer.quit)

    #window.resize(700, 540)

    if len(args) > 0:
        viewer.load_file(args[0])

    #window.show()
    #window.raise_()

    try:
        app.start()

    except KeyboardInterrupt:
        logger.info("Terminating viewer...")
        window.close()
Exemplo n.º 5
0
def main(params):

    ginga_logger = log.get_logger("ginga", options=params)

    ginga_logger.addHandler(
        logging.FileHandler(filename=tempfile.NamedTemporaryFile(
            prefix='ginga', delete=False).name))

    if params.use_opencv:
        from ginga import trcalc
        try:
            trcalc.use('opencv')
        except Exception as ex:
            ginga_logger.warning("Error using OpenCL: {}".format(ex))

    if params.use_opencl:
        from ginga import trcalc
        try:
            trcalc.use('opencl')
        except Exception as ex:
            ginga_logger.warning("Error using OpenCL: {}".format(ex))

    app = Widgets.Application(logger=ginga_logger,
                              host=params.host,
                              port=params.port)

    #  create top level window
    window = app.make_window("Validate", wid='Validate')

    daomop_logger = logging.getLogger('daomop')

    if hasattr(params, 'loglevel'):
        daomop_logger.setLevel(params.loglevel)

    # our own viewer object, customized with methods (see above)
    ValidateGui(daomop_logger, window)

    try:
        app.start()

    except KeyboardInterrupt:
        ginga_logger.info("Terminating viewer...")
        window.close()