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

View File

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