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

Initial support for paramless TC

parent 848fe6e9
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<qresource> <qresource>
<file>logging.ui</file> <file>logging.ui</file>
<file>plotDialog.ui</file> <file>plotDialog.ui</file>
<file>simulation.ui</file>
<file>singleEditor.ui</file> <file>singleEditor.ui</file>
<file>tasteLogo_white.png</file> <file>tasteLogo_white.png</file>
<file>InterfaceEnum.i</file> <file>InterfaceEnum.i</file>
......
This diff is collapsed.
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
import os import os
import ctypes import ctypes
from PySide.QtGui import QDockWidget from PySide.QtGui import QDockWidget, QPushButton, QGridLayout
from PySide.QtCore import Slot, Qt from PySide.QtCore import Slot, Qt, QFile
from PySide.QtUiTools import QUiLoader
import asn1_value_editor import asn1_value_editor
from standalone_editor import asn1sccToasn1ValueEditorTypes from standalone_editor import asn1sccToasn1ValueEditorTypes
import vn import vn
import resources
try: try:
import opengeode import opengeode
except ImportError: except ImportError:
...@@ -68,6 +69,7 @@ class sdlHandler(object): ...@@ -68,6 +69,7 @@ class sdlHandler(object):
self.dock_state = None self.dock_state = None
self.asn1_editor = None self.asn1_editor = None
self.tree_items = {} self.tree_items = {}
self.dock_simu = self.start_simu()
@property @property
def dll(self): def dll(self):
...@@ -105,6 +107,8 @@ class sdlHandler(object): ...@@ -105,6 +107,8 @@ class sdlHandler(object):
item = asn1sccToasn1ValueEditorTypes(dataview, var, sort) item = asn1sccToasn1ValueEditorTypes(dataview, var, sort)
self.tree_items[var] = self.asn1_editor.setAsn1Model(item, row) self.tree_items[var] = self.asn1_editor.setAsn1Model(item, row)
row += 1 row += 1
# In the simulation panel, set the buttons to send paramless TC/timers
self.set_paramless_tc()
@Slot() @Slot()
def startStop(self): def startStop(self):
...@@ -113,9 +117,11 @@ class sdlHandler(object): ...@@ -113,9 +117,11 @@ class sdlHandler(object):
if self.running: if self.running:
self.dock.show() self.dock.show()
self.dock_state.show() self.dock_state.show()
self.dock_simu.show()
else: else:
self.dock.hide() self.dock.hide()
self.dock_state.hide() self.dock_state.hide()
self.dock_simu.hide()
@Slot(unicode) @Slot(unicode)
def change_state(self, new_state): def change_state(self, new_state):
...@@ -156,3 +162,39 @@ class sdlHandler(object): ...@@ -156,3 +162,39 @@ class sdlHandler(object):
as_pyside = vn.fromValueNotationToPySide(var, gser) as_pyside = vn.fromValueNotationToPySide(var, gser)
#print "PYSIDE:", as_pyside #print "PYSIDE:", as_pyside
self.asn1_editor.updateVariable(as_pyside, root=self.tree_items[var]) self.asn1_editor.updateVariable(as_pyside, root=self.tree_items[var])
def start_simu(self):
'''
Set up the simulation bay, from simulation.ui file
This panel handles parameterless signals and
the simulation console'''
ui = QFile(':/simulation.ui')
loader = QUiLoader()
widgets = loader.load(ui, parent=self.parent)
dock = QDockWidget('Simulation bay', self.parent)
dock.setFloating(True)
dock.resize(400, 400)
dock.setObjectName('Simulation')
self.parent.addDockWidget(Qt.RightDockWidgetArea, dock)
dock.setAllowedAreas(Qt.NoDockWidgetArea)
dock.setWidget(widgets)
dock.hide()
return dock
def set_paramless_tc(self):
''' Once the DLL is loaded set the buttons to send paramless TC '''
widget = self.dock_simu.widget()
tc_area = widget.findChild(QGridLayout, 'tc_grid')
# Find parameterless input signals and create buttons
buttons = {}
for each in self.proc.input_signals:
if 'type' not in each:
buttons[each['name']] = QPushButton(each['name'])
for each in self.proc.timers:
buttons[each] = QPushButton(each+' timeout')
for name, button in buttons.viewitems():
tc_area.addWidget(button)
tc = getattr(self.dll, '{}_{}'.format(self.proc.processName,
name))
button.pressed.connect(lambda: tc)
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainEditor</class>
<widget class="QDialog" name="MainEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>471</width>
<height>425</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit ASN.1 value</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Log</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="log">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Console</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Send parameterless telecommands and timers</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="tc_grid"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
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