Move all kivy ui components to subpackage

its_happening
Tyler Goodlet 2020-06-17 14:51:29 -04:00
parent 56f65bcd40
commit ea93e96d88
7 changed files with 21 additions and 16 deletions

View File

@ -964,13 +964,19 @@ def format_option_quote(
# change = percent_change(previous, last)
computed = {
# why QT do you have to be an asshole shipping null values!!!
'$ vol': round((quote['VWAP'] or 0) * (quote['volume'] or 0), 3),
# '$ vol': round((quote['VWAP'] or 0) * (quote['volume'] or 0), 3),
# '%': round(change, 3),
# 'close': previous,
}
new = {}
displayable = {}
vwap = quote.get('VWAP')
volume = quote.get('volume')
if volume is not None: # could be 0
# why questrade do you have to be an asshole shipping null values!!!
computed['$ vol'] = round((vwap or 0) * (volume or 0), 3)
# structuring and normalization
for key, new_key in keymap.items():
display_value = value = computed.get(key) or quote.get(key)

View File

@ -45,7 +45,7 @@ def monitor(config, rate, name, dhost, test, tl):
return
_kivy_import_hack()
from .monitor import _async_main
from .kivy.monitor import _async_main
async def main(tries):
async with maybe_spawn_brokerd_as_subactor(
@ -61,7 +61,7 @@ def monitor(config, rate, name, dhost, test, tl):
partial(main, tries=1),
name='monitor',
loglevel=loglevel if tl else None,
rpc_module_paths=['piker.ui.monitor'],
rpc_module_paths=['piker.ui.kivy.monitor'],
start_method='forkserver',
)
@ -81,7 +81,7 @@ def optschain(config, symbol, date, tl, rate, test):
brokername = config['broker']
_kivy_import_hack()
from .option_chain import _async_main
from .kivy.option_chain import _async_main
async def main(tries):
async with maybe_spawn_brokerd_as_subactor(

View File

@ -15,11 +15,11 @@ from kivy.lang import Builder
from kivy.app import async_runTouchApp
from kivy.core.window import Window
from ..brokers.data import DataFeed
from ...brokers.data import DataFeed
from .tabular import (
Row, TickerTable, _kv, _black_rgba, colorcode,
)
from ..log import get_logger
from ...log import get_logger
from .pager import PagerView

View File

@ -11,7 +11,6 @@ from kivy.properties import BooleanProperty, ObjectProperty
from kivy.core.window import Window
from kivy.clock import Clock
from ...log import get_logger
@ -100,7 +99,8 @@ class MouseOverBehavior(object):
# throttle at 10ms latency
@triggered(timeout=0.01, interval=False)
def _on_mouse_pos(cls, *args):
log.debug(f"{cls} time since last call: {time.time() - cls._last_time}")
log.debug(
f"{cls} time since last call: {time.time() - cls._last_time}")
cls._last_time = time.time()
# XXX: how to still do this at the class level?
# don't proceed if I'm not displayed <=> If have no parent

View File

@ -15,11 +15,10 @@ from kivy.app import async_runTouchApp
from kivy.core.window import Window
from kivy.uix.label import Label
from ..log import get_logger, get_console_log
from ..brokers.data import DataFeed
from ..brokers import get_brokermod
from ...log import get_logger, get_console_log
from ...brokers.data import DataFeed
from ...brokers import get_brokermod
from .pager import PagerView
from .tabular import Row, HeaderCell, Cell, TickerTable
from .monitor import update_quotes

View File

@ -9,8 +9,8 @@ from kivy.uix.widget import Widget
from kivy.uix.textinput import TextInput
from kivy.uix.scrollview import ScrollView
from ..log import get_logger
from .kivy.utils_async import async_bind
from ...log import get_logger
from .utils_async import async_bind
log = get_logger('keyboard')

View File

@ -12,8 +12,8 @@ from kivy.uix.button import Button
from kivy import utils
from kivy.properties import BooleanProperty
from ..log import get_logger
from .kivy.mouse_over import new_mouse_over_group
from ...log import get_logger
from .mouse_over import new_mouse_over_group
HoverBehavior = new_mouse_over_group()