Commit b744eaa7 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Connect parameterless TC to MSC

parent 82d4e1db
......@@ -309,6 +309,7 @@ def gui():
try:
sdl = sdlHandler(myWidget)
sdl.dll = dll
sdl.msc.connect(msc.addToMsc)
except IOError:
log.info('SDL viewer not available')
sdl = None
......
......@@ -19,7 +19,7 @@ import ctypes
from functools import partial
from PySide.QtGui import QDockWidget, QPushButton, QGridLayout
from PySide.QtCore import Slot, Qt, QFile
from PySide.QtCore import QObject, Signal, Slot, Qt, QFile
from PySide.QtUiTools import QUiLoader
import asn1_value_editor
......@@ -38,13 +38,16 @@ except ImportError:
ASN1 = None
class sdlHandler(object):
class sdlHandler(QObject):
'''
Class managing SDL models
'''
# signal sent whenever a paramless TM or TC event happens
msc = Signal(unicode, unicode)
def __init__(self, parent):
''' Startup: check if there are some SDL files in
the directory and try to parse them and build the widget '''
super(sdlHandler, self).__init__()
self.parent = parent
all_files = os.listdir('.')
pr_files = []
......@@ -183,9 +186,10 @@ class sdlHandler(object):
dock.hide()
return dock
def send_tc(self, tc):
def send_tc(self, name, tc_func_ptr):
''' Send a parameterless TC '''
tc()
self.msc.emit('out', name)
tc_func_ptr()
def set_paramless_tc(self):
''' Once the DLL is loaded set the buttons to send paramless TC '''
......@@ -203,5 +207,5 @@ class sdlHandler(object):
self.tc_area.addWidget(button)
tc = getattr(self.dll, '{}_{}'.format(self.proc.processName,
name))
button.pressed.connect(partial(self.send_tc, tc))
button.pressed.connect(partial(self.send_tc, name, 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