Move all kivy ui components to subpackage
parent
56f65bcd40
commit
ea93e96d88
|
@ -964,13 +964,19 @@ def format_option_quote(
|
||||||
# change = percent_change(previous, last)
|
# change = percent_change(previous, last)
|
||||||
computed = {
|
computed = {
|
||||||
# why QT do you have to be an asshole shipping null values!!!
|
# 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),
|
# '%': round(change, 3),
|
||||||
# 'close': previous,
|
# 'close': previous,
|
||||||
}
|
}
|
||||||
new = {}
|
new = {}
|
||||||
displayable = {}
|
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
|
# structuring and normalization
|
||||||
for key, new_key in keymap.items():
|
for key, new_key in keymap.items():
|
||||||
display_value = value = computed.get(key) or quote.get(key)
|
display_value = value = computed.get(key) or quote.get(key)
|
||||||
|
|
|
@ -45,7 +45,7 @@ def monitor(config, rate, name, dhost, test, tl):
|
||||||
return
|
return
|
||||||
|
|
||||||
_kivy_import_hack()
|
_kivy_import_hack()
|
||||||
from .monitor import _async_main
|
from .kivy.monitor import _async_main
|
||||||
|
|
||||||
async def main(tries):
|
async def main(tries):
|
||||||
async with maybe_spawn_brokerd_as_subactor(
|
async with maybe_spawn_brokerd_as_subactor(
|
||||||
|
@ -61,7 +61,7 @@ def monitor(config, rate, name, dhost, test, tl):
|
||||||
partial(main, tries=1),
|
partial(main, tries=1),
|
||||||
name='monitor',
|
name='monitor',
|
||||||
loglevel=loglevel if tl else None,
|
loglevel=loglevel if tl else None,
|
||||||
rpc_module_paths=['piker.ui.monitor'],
|
rpc_module_paths=['piker.ui.kivy.monitor'],
|
||||||
start_method='forkserver',
|
start_method='forkserver',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ def optschain(config, symbol, date, tl, rate, test):
|
||||||
brokername = config['broker']
|
brokername = config['broker']
|
||||||
|
|
||||||
_kivy_import_hack()
|
_kivy_import_hack()
|
||||||
from .option_chain import _async_main
|
from .kivy.option_chain import _async_main
|
||||||
|
|
||||||
async def main(tries):
|
async def main(tries):
|
||||||
async with maybe_spawn_brokerd_as_subactor(
|
async with maybe_spawn_brokerd_as_subactor(
|
||||||
|
|
|
@ -15,11 +15,11 @@ 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 ..brokers.data import DataFeed
|
from ...brokers.data import DataFeed
|
||||||
from .tabular import (
|
from .tabular import (
|
||||||
Row, TickerTable, _kv, _black_rgba, colorcode,
|
Row, TickerTable, _kv, _black_rgba, colorcode,
|
||||||
)
|
)
|
||||||
from ..log import get_logger
|
from ...log import get_logger
|
||||||
from .pager import PagerView
|
from .pager import PagerView
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ from kivy.properties import BooleanProperty, ObjectProperty
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
|
||||||
|
|
||||||
from ...log import get_logger
|
from ...log import get_logger
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +99,8 @@ class MouseOverBehavior(object):
|
||||||
# throttle at 10ms latency
|
# throttle at 10ms latency
|
||||||
@triggered(timeout=0.01, interval=False)
|
@triggered(timeout=0.01, interval=False)
|
||||||
def _on_mouse_pos(cls, *args):
|
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()
|
cls._last_time = time.time()
|
||||||
# XXX: how to still do this at the class level?
|
# XXX: how to still do this at the class level?
|
||||||
# don't proceed if I'm not displayed <=> If have no parent
|
# don't proceed if I'm not displayed <=> If have no parent
|
||||||
|
|
|
@ -15,11 +15,10 @@ 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 kivy.uix.label import Label
|
||||||
|
|
||||||
from ..log import get_logger, get_console_log
|
from ...log import get_logger, get_console_log
|
||||||
from ..brokers.data import DataFeed
|
from ...brokers.data import DataFeed
|
||||||
from ..brokers import get_brokermod
|
from ...brokers import get_brokermod
|
||||||
from .pager import PagerView
|
from .pager import PagerView
|
||||||
|
|
||||||
from .tabular import Row, HeaderCell, Cell, TickerTable
|
from .tabular import Row, HeaderCell, Cell, TickerTable
|
||||||
from .monitor import update_quotes
|
from .monitor import update_quotes
|
||||||
|
|
|
@ -9,8 +9,8 @@ from kivy.uix.widget import Widget
|
||||||
from kivy.uix.textinput import TextInput
|
from kivy.uix.textinput import TextInput
|
||||||
from kivy.uix.scrollview import ScrollView
|
from kivy.uix.scrollview import ScrollView
|
||||||
|
|
||||||
from ..log import get_logger
|
from ...log import get_logger
|
||||||
from .kivy.utils_async import async_bind
|
from .utils_async import async_bind
|
||||||
|
|
||||||
log = get_logger('keyboard')
|
log = get_logger('keyboard')
|
||||||
|
|
|
@ -12,8 +12,8 @@ from kivy.uix.button import Button
|
||||||
from kivy import utils
|
from kivy import utils
|
||||||
from kivy.properties import BooleanProperty
|
from kivy.properties import BooleanProperty
|
||||||
|
|
||||||
from ..log import get_logger
|
from ...log import get_logger
|
||||||
from .kivy.mouse_over import new_mouse_over_group
|
from .mouse_over import new_mouse_over_group
|
||||||
|
|
||||||
|
|
||||||
HoverBehavior = new_mouse_over_group()
|
HoverBehavior = new_mouse_over_group()
|
Loading…
Reference in New Issue