use CeoFrame as parent class for TransactionView

pull/20/head
Max Erenberg 2 years ago
parent 40ee927b91
commit 39158676ae
  1. 2
      ceo/tui/CeoFrame.py
  2. 22
      ceo/tui/TransactionView.py

@ -31,7 +31,7 @@ class CeoFrame(Frame):
def _ceoframe_on_load(self):
# We usually don't want _on_load() to be called multiple times
# e.g. when switching back to a scene
# e.g. when switching back to a scene, or after calling reset()
if self._loaded:
return
self._loaded = True

@ -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

Loading…
Cancel
Save