Commit 82d4e1db authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Workaround pyside bug

parent ca908dd9
......@@ -16,6 +16,7 @@
import os
import ctypes
from functools import partial
from PySide.QtGui import QDockWidget, QPushButton, QGridLayout
from PySide.QtCore import Slot, Qt, QFile
......@@ -36,6 +37,7 @@ except ImportError:
print 'No Python A mapper generated dataview, SDL handler cannot be used'
ASN1 = None
class sdlHandler(object):
Class managing SDL models
......@@ -181,20 +183,25 @@ class sdlHandler(object):
return dock
def send_tc(self, tc):
''' Send a parameterless TC '''
def set_paramless_tc(self):
''' Once the DLL is loaded set the buttons to send paramless TC '''
# tc_area and buttons have to be in self because of known pyside bug
widget = self.dock_simu.widget()
tc_area = widget.findChild(QGridLayout, 'tc_grid')
self.tc_area = widget.findChild(QGridLayout, 'tc_grid')
# Find parameterless input signals and create buttons
buttons = {}
self.buttons = {}
for each in self.proc.input_signals:
if 'type' not in each:
buttons[each['name']] = QPushButton(each['name'])
self.buttons[each['name']] = QPushButton(each['name'])
for each in self.proc.timers:
buttons[each] = QPushButton(each+' timeout')
for name, button in buttons.viewitems():
self.buttons[each] = QPushButton(each+' timeout')
for name, button in self.buttons.viewitems():
tc = getattr(self.dll, '{}_{}'.format(self.proc.processName,
button.pressed.connect(lambda: tc)
button.pressed.connect(partial(self.send_tc, tc))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment