コード例 #1
0
 def test_proxy_resync(self):
     from pizco import Server
     pxy = Server.serve_in_process(RemotePizcoEmitter,(),{},rep_endpoint="tcp://127.0.0.1:1111")
     app = QApplication([])
     resync_proxy(pxy)
     from threading import Thread
     import numpy as np
     from guiqwt.plot import ImageWidget
     from guiqwt.builder import make
     import time
     im = ImageWidget()
     im.register_all_curve_tools()
     ts = TestSync()
     def test_thread():
         ts.initialize_subobject(im)
         pxy.std_signal.connect(ts.receiver_int)
         #std_signal.connect(pg.setValue)
         #test_built_in.connect(pg.setRange)
         v_int = 0
         while True:
             v_int += 1
             #ts.update_curve() goes through a non generic signal
             pxy.emission()
             time.sleep(0.5)
             if v_int==5:
                 break
         im.close()
     t = Thread(None,test_thread)
     t.start()
     im.show()
     app.exec_()
     pxy._proxy_stop_server()
     pxy._proxy_stop_me()
     assert(ts._internal_value != 0)
コード例 #2
0
ファイル: test_pizco.py プロジェクト: achennu/pizco
    def test_agent_serve_in_process(self):

        address = 'tcp://127.0.0.1:9874'
        proxy = Server.serve_in_process(Example, (), {}, address)

        time.sleep(SLEEP_SECS * 10)

        self.assertEqual(proxy.simple_attribute, 12)

        proxy._proxy_stop_server()
        proxy._proxy_stop_me()
コード例 #3
0
    def test_agent_serve_in_process(self):

        address = 'tcp://127.0.0.1:9874'
        proxy = Server.serve_in_process(Example, (), {}, address)

        time.sleep(SLEEP_SECS * 10)

        self.assertEqual(proxy.simple_attribute, 12)

        proxy._proxy_stop_server()
        proxy._proxy_stop_me()
コード例 #4
0
    def test_proxy_resync(self):
        from pizco import Server
        pxy = Server.serve_in_process(RemotePizcoEmitter, (), {},
                                      rep_endpoint="tcp://127.0.0.1:1111")
        app = QApplication([])
        resync_proxy(pxy)
        from threading import Thread
        import numpy as np
        from guiqwt.plot import ImageWidget
        from guiqwt.builder import make
        import time
        im = ImageWidget()
        im.register_all_curve_tools()
        ts = TestSync()

        def test_thread():
            ts.initialize_subobject(im)
            pxy.std_signal.connect(ts.receiver_int)
            #std_signal.connect(pg.setValue)
            #test_built_in.connect(pg.setRange)
            v_int = 0
            while True:
                v_int += 1
                #ts.update_curve() goes through a non generic signal
                pxy.emission()
                time.sleep(0.5)
                if v_int == 5:
                    break
            im.close()

        t = Thread(None, test_thread)
        t.start()
        im.show()
        app.exec_()
        pxy._proxy_stop_server()
        pxy._proxy_stop_me()
        assert (ts._internal_value != 0)
コード例 #5
0
import time
import argparse

from pizco import Server

from common import House

parser = argparse.ArgumentParser('Start house server')
parser.add_argument('-v', '--verbose', action='store_true',
                    help='Print logging output')
parser.add_argument('-g', '--gui', action='store_true',
                    help='Show graphical user interface')

args = parser.parse_args()

proxy = Server.serve_in_process(House, (), {}, 'tcp://127.0.0.1:8000',
                                verbose=args.verbose, gui=args.gui)

time.sleep(1)

proxy.door_open = True
proxy.lights_on = True
time.sleep(.1)
proxy.paint('green')
proxy.lights_on = False
proxy.door_open = False

for step in range(3, 0, -1):
    time.sleep(1)
    print('Stopping in {}'.format(step))

proxy._proxy_stop_server()
コード例 #6
0
ファイル: gui_server.py プロジェクト: PierreBizouard/pizco
# -*- coding: utf-8 -*-

from pizco import Server

from common import House

s = Server.serve_in_process(
    House, args=(), kwargs={}, rep_endpoint='tcp://127.0.0.1:8000',
    gui=True, verbose=True)
コード例 #7
0
# -*- coding: utf-8 -*-

from pizco import Server

from common import House

s = Server.serve_in_process(House,
                            args=(),
                            kwargs={},
                            rep_endpoint='tcp://127.0.0.1:8000',
                            gui=True,
                            verbose=True)
コード例 #8
0
from common import House

parser = argparse.ArgumentParser('Start house server')
parser.add_argument('-v',
                    '--verbose',
                    action='store_true',
                    help='Print logging output')
parser.add_argument('-g',
                    '--gui',
                    action='store_true',
                    help='Show graphical user interface')

args = parser.parse_args()

proxy = Server.serve_in_process(House, (), {},
                                'tcp://127.0.0.1:8000',
                                verbose=args.verbose,
                                gui=args.gui)

time.sleep(1)

proxy.door_open = True
proxy.lights_on = True
time.sleep(.1)
proxy.paint('green')
proxy.lights_on = False
proxy.door_open = False

for step in range(3, 0, -1):
    time.sleep(1)
    print('Stopping in {}'.format(step))