Ejemplo n.º 1
0
 def write(self, text):
     try:
         comm = Communicator(gtkserver.REQUEST_PORT)
         comm.open()
         comm.sendObject(text)
         comm.close()
     except:
         pass
Ejemplo n.º 2
0
 def close_answer(self, answer):
     try:
         comm = Communicator(answer.port)
         comm.open()
         comm.sendObject("die!")
         comm.close()
     except Exception, error:
         sys.stderr.write("%d\n%s\n%s\n" % (self.request_port, traceback(error), error))
Ejemplo n.º 3
0
 def insert_refs(self, widget, data=None):
     refs = self.table.getSelected()
     comm = Communicator(self.REF_LISTEN_PORT)
     nfailed = 0
     sent = False
     try:
         comm.sendObject(refs)
         comm.close()
         sent = True
     except Exception, error:
         pass
Ejemplo n.º 4
0
 def display_report(cls):
     try:
         import inspect
         frame = inspect.currentframe().f_back.f_back.f_back
         info = inspect.getframeinfo(frame)
         framestr = "%s" % str(info)
         comm = Communicator(cls.port)
         comm.open()
         comm.sendObject(framestr)
         comm.close()
     except Exception, error:
         sys.stderr.write("%s\n" % error)
Ejemplo n.º 5
0
    def run(self):
        while 1:
            ret = ""
            try:
                obj = self.server.acceptObject()
                if isinstance(obj, ServerStop): #end
                    self.stop()
                    return

                ret = self.process(obj)
            except SocketDie:
                return
            except Exception, error:
                sys.stderr.write("%s\n%s\n" % (traceback(error), error))


            try:
                if self.answer_port:
                    comm = Communicator(self.answer_port)
                    comm.open()
                    comm.sendObject(ret)
                    comm.close()
            except SocketOpenError, error:
                sys.stderr.write("%d\n%s\n%s\n" % (self.answer_port, traceback(error), error))
Ejemplo n.º 6
0
 def stop(self):
     comm = Communicator(self.server.request_port)
     comm.open()
     comm.sendObject(ServerStop())
     comm.close()
     self.thr.join()