Add contract table type headers

kivy_mainline_and_py3.8
Tyler Goodlet 2018-12-29 16:01:07 -05:00
parent b4fad3f6a9
commit 3ed750d324
1 changed files with 17 additions and 3 deletions

View File

@ -14,6 +14,7 @@ from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder from kivy.lang import Builder
from kivy.app import async_runTouchApp from kivy.app import async_runTouchApp
from kivy.core.window import Window from kivy.core.window import Window
from kivy.uix.label import Label
from ..log import get_logger from ..log import get_logger
from ..brokers.core import contracts from ..brokers.core import contracts
@ -188,7 +189,7 @@ class DataFeed(object):
# get first quotes response # get first quotes response
log.debug(f"Waiting on first quote for {symbols}...") log.debug(f"Waiting on first quote for {symbols}...")
quotes = {} quotes = {}
with trio.move_on_after(5): # with trio.move_on_after(5):
quotes = await quote_gen.__anext__() quotes = await quote_gen.__anext__()
self.quote_gen = quote_gen self.quote_gen = quote_gen
@ -359,7 +360,7 @@ async def new_chain_ui(
symbol: str, symbol: str,
brokermod: types.ModuleType, brokermod: types.ModuleType,
nursery: trio._core._run.Nursery, nursery: trio._core._run.Nursery,
rate: int = 2, rate: int = 1,
) -> None: ) -> None:
"""Create and return a new option chain UI. """Create and return a new option chain UI.
""" """
@ -412,6 +413,17 @@ async def new_chain_ui(
# top row of expiry buttons # top row of expiry buttons
container.add_widget(expiry_buttons) container.add_widget(expiry_buttons)
# denote calls vs. puts side of table
type_header = BoxLayout(
orientation='horizontal',
size_hint=(1, 1/28.),
)
calls = Label(text='calls', font_size='20')
puts = Label(text='puts', font_size='20')
type_header.add_widget(calls)
type_header.add_widget(puts)
container.add_widget(type_header)
# figure out header fields for each table based on quote keys # figure out header fields for each table based on quote keys
headers = displayables[0].keys() headers = displayables[0].keys()
header_row = StrikeRow(strike='strike', size_hint=(1, None)) header_row = StrikeRow(strike='strike', size_hint=(1, None))
@ -435,6 +447,8 @@ async def new_chain_ui(
size_hint=(1, None), size_hint=(1, None),
) )
container.add_widget(header_row) container.add_widget(header_row)
# build out chain tables
table = TickerTable( table = TickerTable(
sort_key='strike', sort_key='strike',
cols=1, cols=1,