|
|
|
@ -1,29 +1,23 @@ |
|
|
|
|
from threading import Thread |
|
|
|
|
|
|
|
|
|
from asciimatics.exceptions import NextScene |
|
|
|
|
from asciimatics.widgets import Frame, Layout, Button, Divider, Label |
|
|
|
|
from asciimatics.widgets import Layout, Button, Divider, Label |
|
|
|
|
|
|
|
|
|
from ..operation_strings import descriptions as op_desc |
|
|
|
|
from ..utils import generic_handle_stream_response |
|
|
|
|
from .CeoFrame import CeoFrame |
|
|
|
|
from .TUIStreamResponseHandler import TUIStreamResponseHandler |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TransactionView(Frame): |
|
|
|
|
class TransactionView(CeoFrame): |
|
|
|
|
def __init__(self, screen, width, height, model): |
|
|
|
|
super().__init__( |
|
|
|
|
screen, |
|
|
|
|
height, |
|
|
|
|
width, |
|
|
|
|
can_scroll=False, |
|
|
|
|
on_load=self._txnview_on_load, |
|
|
|
|
title='Running Transaction', |
|
|
|
|
screen, height, width, model, 'Transaction', |
|
|
|
|
on_load=self._txnview_on_load, title='Running Transaction', |
|
|
|
|
) |
|
|
|
|
self._model = model |
|
|
|
|
# map operation names to label widgets |
|
|
|
|
self._labels = model.viewdata['Transaction']['labels'] |
|
|
|
|
# this is an ugly hack to get around the fact that _on_load() |
|
|
|
|
# will be called again when we reset() in enable_next_btn. |
|
|
|
|
self._loaded = False |
|
|
|
|
|
|
|
|
|
def _add_buttons(self): |
|
|
|
|
layout = Layout([100]) |
|
|
|
@ -44,13 +38,9 @@ class TransactionView(Frame): |
|
|
|
|
self._op_layout.add_widget(Label(''), 2) |
|
|
|
|
|
|
|
|
|
def _txnview_on_load(self): |
|
|
|
|
if self._loaded: |
|
|
|
|
return |
|
|
|
|
self._loaded = True |
|
|
|
|
|
|
|
|
|
d = self._model.viewdata['Transaction'] |
|
|
|
|
first_time = True |
|
|
|
|
if d['op_layout'] is None: |
|
|
|
|
first_time = True |
|
|
|
|
self._op_layout = Layout([12, 1, 10]) |
|
|
|
|
self.add_layout(self._op_layout) |
|
|
|
|
# store the layouts so that we can re-use them when the screen |
|
|
|
|