Move all kivy ui components to subpackage

bar_select
Tyler Goodlet 2020-06-17 14:51:29 -04:00
parent 9d6dffe5ec
commit 82a5daf91b
6 changed files with 18 additions and 13 deletions

View File

@ -989,13 +989,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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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')

View File

@ -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()