Crux
unread,Apr 19, 2009, 4:28:20 AM4/19/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rpyc
Hi,
Maybe you can help me with this issue, I'm not sure if it is possible
to implement this with rpyc. I'm writing a Qt console application
based on the Qt signal and slot mechanism (Pyqt). Assume you have an
application running on two different systems A and B.
I want to attach the signals generated within the application running
on system A to the event loop running within the application of system
B.
I want to attach the signals generated within the application running
on system B to the event loop running within the application of system
A.
Pseudo code will be something like (endless turning on and off the
lamps:) ):
-&<---------Code System A-------------------------------------
from PyQt4 import QtCore
app=QtCore.QCoreApplication(sys.argv)
class simpleLamp(QtCore.QObject):
def __init__(self):
QtCore.QObject.__init__(self)
def onLightOn(self):
self.emit(QtCore.SIGNAL("lightOn(PyQt_PyObject)"))
def onLightOff(self):
self.emit(QtCore.SIGNAL("lightOff(PyQt_PyObject)"))
def lightOn(self):
print "Turn light on"
self.onLightOn()
def lightOff(self):
print "Turn light off"
self.onLightOff()
bedroomLamp = simpleLamp()
#kitchenLamp is an instance on system B
QtCore.QObject.connect(kitchenLamp, QtCore.SIGNAL("LightOn
(PyQt_PyObject)"), bedroomLamp, QtCore.SLOT("lightOff()"))
QtCore.QObject.connect(kitchenLamp, QtCore.SIGNAL("LightOff
(PyQt_PyObject)"), bedroomLamp, QtCore.SLOT("lightOn()"))
sys.exit(app.exec_())
-&<---------Code System B-------------------------------------
from PyQt4 import QtCore
app=QtCore.QCoreApplication(sys.argv)
class simpleLamp(QtCore.QObject):
def __init__(self):
QtCore.QObject.__init__(self)
def onLightOn(self):
self.emit(QtCore.SIGNAL("lightOn(PyQt_PyObject)"))
def onLightOff(self):
self.emit(QtCore.SIGNAL("lightOff(PyQt_PyObject)"))
def lightOn(self):
print "Turn light on"
self.onLightOn()
def lightOff(self):
print "Turn light off"
self.onLightOff()
kitchenLamp = simpleLamp()
#bedroomLamp is an instance on system A
QtCore.QObject.connect(bedroomLamp, QtCore.SIGNAL("LightOn
(PyQt_PyObject)"), kitchenLamp, QtCore.SLOT("lightOff()"))
QtCore.QObject.connect(bedroomLamp, QtCore.SIGNAL("LightOff
(PyQt_PyObject)"), kitchenLamp, QtCore.SLOT("lightOn()"))
sys.exit(app.exec_())
The problem is making the simpleLamp instance on system A looking
local to system B and vise versa. And even if that would be possible
I'm not sure if that instance would be able to generate an event for
the remote and local event loop.
Thank you.
Best regards,
Crux