|
From: Chunqing D. <cd...@uw...> - 2013-04-25 03:28:42
|
Dear Qtlab users,
We are trying to build a GUI on top of Qtlab for parameter management and performing multi-dimensional sweeps in experiments. I have noticed the qtlab gui interact with the shell through SharedGObject.So I wrote a simple class for testing as below:
from lib.network.object_sharer import SharedGObject
class Test_share_class(SharedGObject):
att = 1
def __init__(self, **kwargs):
SharedGObject.__init__(self, 'test_share')
def do_sth_to_let_GUI_know(self):
print "In Qtlab shell"
def func_called_by_GUI(self):
print "Called by GUI"
self.att = self.att + 1
In the GUI client site, I have the following code:
import gtk
from gettext import gettext as _L
from lib.network.object_sharer import helper
class SQD_GUI_START(gtk.Button):
def __init__(self):
gtk.Button.__init__(self, _L('SQD GUI'))
self.set_sensitive(True)
self.connect('clicked', self._call_func)
def _call_func(self, sender):
'''
behavior when clicking the button
'''
ob = helper.find_object('test_share')
ob.func_called_by_GUI()
Using this, I can call the function "func_called_by_GUI" from the GUI by clicking a button.
Additionally, I would like to make the GUI acknowledge whenever "do_sth_to_let_GUI_know" is called using the qtlab shell. Would some of you give me some advice on how to implement this functionality? I will really appreciate it.
Regards,
Chunqing Deng
|