方法标题:
@engine.async
@guiLoop
def for_every_client(self):
使用方法连接PySide信号:
self.ui.pushButton.clicked.connect(lambda: self.for_every_client(self))
stacktarce - http://pastebin.com/R1ZKcdPy
或在这里:
Traceback (most recent call last):
File "app2.py", line 437, in <lambda>
self.ui.pushButton.clicked.connect(lambda: self.for_every_client(self))
File "c:\Python27\lib\site-packages\async_gui\engine.py", line 79, in wrapper
gen = func(*args, **kwargs)
File "C:\visa\visa_production\libs\guiLoop.py", line 70, in __call__
_loop_in_the_gui(gui_element, generator, self.start_in_gui)
File "C:\visa\visa_production\libs\guiLoop.py", line 44, in _loop_in_the_gui
wait_time = next(generator)
File "app2.py", line 530, in for_every_client
p.start()
File "c:\Python27\lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
File "c:\Python27\lib\multiprocessing\forking.py", line 277, in __init__
dump(process_obj, to_child, HIGHEST_PROTOCOL)
File "c:\Python27\lib\multiprocessing\forking.py", line 199, in dump
ForkingPickler(file, protocol).dump(obj)
File "c:\Python27\lib\pickle.py", line 224, in dump
self.save(obj)
File "c:\Python27\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "c:\Python27\lib\pickle.py", line 425, in save_reduce
save(state)
File "c:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\Python27\lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "c:\Python27\lib\pickle.py", line 687, in _batch_setitems
save(v)
File "c:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\Python27\lib\pickle.py", line 554, in save_tuple
save(element)
File "c:\Python27\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "c:\Python27\lib\pickle.py", line 425, in save_reduce
save(state)
File "c:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\Python27\lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "c:\Python27\lib\pickle.py", line 687, in _batch_setitems
save(v)
File "c:\Python27\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "c:\Python27\lib\pickle.py", line 425, in save_reduce
save(state)
File "c:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\Python27\lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "c:\Python27\lib\pickle.py", line 687, in _batch_setitems
save(v)
File "c:\Python27\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "c:\Python27\lib\pickle.py", line 396, in save_reduce
save(cls)
File "c:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\Python27\lib\pickle.py", line 754, in save_global
(obj, module, name))
pickle.PicklingError: Can't pickle <type 'PySide.QtCore.SignalInstance'>: it's n
ot found as PySide.QtCore.SignalInstance
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\Python27\lib\multiprocessing\forking.py", line 381, in main
self = load(from_parent)
File "c:\Python27\lib\pickle.py", line 1384, in load
return Unpickler(file).load()
File "c:\Python27\lib\pickle.py", line 864, in load
dispatch[key](self)
File "c:\Python27\lib\pickle.py", line 886, in load_eof
raise EOFError
EOFError
答案 0 :(得分:0)
class Window
SignalProgressBar = QtCore.pyqtSignal()
def __init__(self):
self.SignalProgressBar.connect(lambda: self.for_every_client(self))
用方法连接信号:
w = Window()
w.SignalProgressBar.emit()