예제 #1
0
class EventoTecladoRemotoEnviar(EventoTeclado):
    def __init__(self, parent=None):
        super().__init__(parent)
        self._servico = ServicoInformacao(40126, 40125)
        self._servico.setPara('127.0.0.1')
        
    def _entrarTecla(self, letra):
        super()._entrarTecla(letra)
        self._servico.enviarPacoteInformacao(letra)
예제 #2
0
class CApplicationEnviar(CApplication):
    def __init__(self, parent=None):
        super().__init__(parent)
        self._servico = ServicoInformacao(40133, 40132)
        self._servico.setPara('127.0.0.1')
        self.setEventoTeclado(EventoTecladoRemotoReceber())
        self.telaAtualizada.connect(self._enviarTela)

    def _enviarTela(self):
        self._servico.enviarPacoteInformacao(CApplicationEnviar._getDesenhoTela())
#-*- coding: utf-8 -*-

from PyQt4.QtGui import QApplication

from networkService.servicos.servicoInformacao import ServicoInformacao


def teste(de, tipo, valor):
    assert tipo == 0
    assert valor == {"teste":"1", "tt":"2"}
    print("OK")
    
def teste2(de, valor):
    assert valor == "qwe"
    print("OK")


app = QApplication([])

a = ServicoInformacao(1234, 1234)
a.setPara('127.0.0.1')

a.informacaoTipoValorRecebida.connect(teste)
a.pacoteInformacaoRecebida.connect(teste2)

a.enviarInformacaoTipoValor(0, {"teste":"1", "tt":"2"})
a.enviarPacoteInformacao("qwe")

app.exec_()