Exemple #1
0
 def __init__(self, logMessages=False):
     super(GuiProcess, self).__init__()
     self.pid = Process.attach("GUI", self)
     self.messages = PatternMatcher()
     self.isOpen = True
     self.logger = Process.logger()
     self.logMessages = logMessages
Exemple #2
0
 def event(self, ev):
     """ Handle events sent to the object. """
     if ev.type() == MessageReceivedEvent.Type:
         if self.logMessages:
             self.logger.info("Received message %s.", repr(ev.m))
         try:
             self.messages.match(ev.m)
         except Exception:
             Process.logger().exception("An exception was raised by the process")
         return True
     else:
         return False
Exemple #3
0
 def testClientServerNegociation(self):
     """ Negociation should work out with client and server using the same negociation code. """
     pid = Process.current()
     c, s = Pipe.create()
     def server():
         name = negociateProtocol(s, False)
         Process.send(pid, name)
     def client():
         name = negociateProtocol(c, True)
         Process.send(pid, name)
     Process.spawn(server)
     Process.spawn(client)
     firstName = Process.receive()
     secondName = Process.receive()
     for name in (firstName, secondName):
         self.assertTrue(name in Supported)
     self.assertEqual(firstName, secondName)
Exemple #4
0
 def client():
     name = negociateProtocol(c, True)
     Process.send(pid, name)
Exemple #5
0
 def server():
     name = negociateProtocol(s, False)
     Process.send(pid, name)
Exemple #6
0
 def __exit__(self, type, e, traceback):
     Process.detach()