Drop godwidget ref to `FieldsForm`

fsp_feeds
Tyler Goodlet 2021-08-11 14:02:46 -04:00
parent 7295ceb51a
commit 1d7300577e
2 changed files with 6 additions and 11 deletions

View File

@ -492,6 +492,7 @@ class LinkedSplits(QWidget):
# so we can look this up and add back to the splitter
# on a symbol switch
cpw.qframe = qframe
assert cpw.parent() == qframe
# add sidepane **after** chart; place it on axis side
if sidepane:
@ -1062,7 +1063,7 @@ class ChartPlotWidget(pg.PlotWidget):
self.scene().leaveEvent(ev)
_clear_throttle_rate: int = 60 # Hz
_clear_throttle_rate: int = 50 # Hz
_book_throttle_rate: int = 16 # Hz
@ -1388,7 +1389,6 @@ async def run_fsp(
) as stream,
open_form(
godwidget=linkedsplits.godwidget,
parent=linkedsplits.godwidget,
fields_schema={
'name': {
@ -1655,7 +1655,7 @@ async def display_symbol_data(
for sym, quote in quotes.items():
ticks = quote.get('ticks', ())
if ticks:
print(f'{1/period} Hz')
# print(f'{1/period} Hz')
last_tick = time.time()
n.start_soon(print_quotes)
@ -1841,12 +1841,12 @@ async def _async_main(
# generate order mode side-pane UI
async with (
trio.open_nursery() as root_n,
# fields form to configure order entry
open_form(
godwidget=godwidget,
parent=godwidget,
fields_schema={
'account': {

View File

@ -163,20 +163,16 @@ class FontScaledDelegate(QStyledItemDelegate):
class FieldsForm(QWidget):
godwidget: 'GodWidget' # noqa
vbox: QVBoxLayout
form: QFormLayout
def __init__(
self,
godwidget: 'GodWidget', # type: ignore # noqa
parent=None,
) -> None:
super().__init__(parent or godwidget)
self.godwidget = godwidget
super().__init__(parent)
# size it as we specify
self.setSizePolicy(
@ -374,7 +370,6 @@ async def handle_field_input(
@asynccontextmanager
async def open_form(
godwidget: QWidget,
parent: QWidget,
fields_schema: dict,
# alloc: Allocator,
@ -382,7 +377,7 @@ async def open_form(
) -> FieldsForm:
fields = FieldsForm(godwidget, parent=parent)
fields = FieldsForm(parent=parent)
from ._position import mk_pp_alloc
alloc = mk_pp_alloc()
fields.model = alloc