コード例 #1
0
 def __init__(self, app, name, ctrlAddr, dataPort):
     self.app = app
     self.name = name
     self.ctrlAddr = ctrlAddr
     self.dataPort = dataPort
     self.ctrlCtx = pomp.Context(GndCtrlItf._CtrlEventHandler(self))
     self.dataCtx = pomp.Context(GndCtrlItf._DataEventHandler(self))
     self.sections = {}
コード例 #2
0
    def run(self):
        # Setup loop for main thread
        pomp.looper.prepareLoop()
        self.timerHandler = pomp.looper.Handler(self.onTimer)

        # Setup timeout if needed
        if self.timeout >= 0:
            self.setupTimeout()

        # Create pomp context
        self.ctx = pomp.Context(self)
        if self.udp:
            self.ctx.bind(self.sockFamily, self.sockAddr)
        elif self.server:
            self.ctx.listen(self.sockFamily, self.sockAddr)
        else:
            self.ctx.connect(self.sockFamily, self.sockAddr)

        # Run main loop
        try:
            pomp.looper.runLoop()
        except KeyboardInterrupt:
            pomp.looper.exitLoop()

        # Stop everything
        self.ctx.stop()
コード例 #3
0
ファイル: RobotItf.py プロジェクト: LucBanda/scratchy
 def __init__(self, addrString, role="server"):
     (family, addr) = pomp.parseAddr(addrString)
     self.pompCtx = pomp.Context(self)
     self.role = role
     if self.role == "server":
         self.pompCtx.listen(family, addr)
     elif self.role == "udp":
         self.pompCtx.bind(family, addr)
     else:
         self.pompCtx.connect(family, addr)
コード例 #4
0
    def __init__(self, address):
        super(SocketLedDriverClient, self).__init__()
        window = gtk.Window()
        window.set_title("Socket led driver client - evinrude")
        window.connect("destroy", self.on_window_destroy)

        pomp.looper.prepareLoop(self)
        self.ctx = pomp.Context(self)
        (self.sockFamily, self.sockAddr) = pomp.parseAddr(address)
        self.ctx.connect(self.sockFamily, self.sockAddr)

        self.label = gtk.Label()
        self.label.set_text("DISCONNECTED")
        self.event_box = gtk.EventBox()
        self.event_box.add(self.label)
        self.color = gtk.gdk.Color()
        self.event_box.modify_bg(gtk.STATE_NORMAL, self.color)

        window.add(self.event_box)
        window.resize(400, 400)
        window.show_all()