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

Test/improve undo feature

parent 091d4227
......@@ -354,7 +354,9 @@ def gui():
{'dll': Signal(unicode, type, type)})
encoder_backend.send_via_dll = DLLHandler()
encoder_backend.send_via_dll.dll.connect(sdl.send_tc)
editor.msc.connect(sdl.add_to_msc)
if isinstance(editor, asn1Viewer):
# Connect TM to MSC
editor.msc.connect(sdl.add_to_msc)
else:
editor.msc.connect(msc.addToMsc)
......
......@@ -324,14 +324,14 @@ class sdlHandler(QObject):
def send_tc(self, name, tc_func_ptr, param=None):
''' Send a TC - Used either locally (parameterless TCs) or via
a signal sent by the B-mapper-generated backends '''
if name in self.timers:
# self.buttons[name].setEnabled(False)
self.add_to_msc('timeout', name)
elif not param:
msg = '{tc}{arg}'.format(tc=name,
arg='({})'.format(param.GSER()) if param else '')
self.add_to_msc('out', msg)
with undo.UndoMacro(self.undo_stack, 'Send TC'):
if name in self.timers:
self.add_to_msc('timeout', name)
else:
msg = '{tc}{arg}'.format(tc=name,
arg='({})'.format(param.GSER())
if param else '')
self.add_to_msc('out', msg)
undo_cmd = SendTC(self, tc_func_ptr, param)
self.undo_stack.push(undo_cmd)
self.check_state()
......
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