From a7fb55179c977cbe41a47d1fe269124cfffbafb3 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 23 Dec 2018 21:26:57 -0500 Subject: [PATCH] Handle weekend data from QT yet again --- piker/ui/monitor.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/piker/ui/monitor.py b/piker/ui/monitor.py index be5915a0..1ff98d0b 100644 --- a/piker/ui/monitor.py +++ b/piker/ui/monitor.py @@ -81,6 +81,7 @@ _kv = (f''' # this is currently used for expiry cells on the options chain background_color: {_i3_rgba} if self.click_toggle else {_black_rgba} # must be set to allow 'plain bg colors' since default texture is grey + # but right now is only set for option chain expiry buttons # background_normal: '' # spacing: 0, 0 # padding: 3, 3 @@ -165,8 +166,8 @@ class Cell(Button): self.row = None self.is_header = is_header - # def on_press(self, value=None): - # self.row.on_press() + def on_press(self, value=None): + self.row.on_press() class HeaderCell(Cell): @@ -352,13 +353,16 @@ class Row(ButtonBehavior, HoverBehavior, GridLayout): fgreen = colorcode('forestgreen') red = colorcode('red2') for key, val in record.items(): - # logic for cell text coloring: up-green, down-red - if self._last_record[key] < val: - color = fgreen - elif self._last_record[key] > val: - color = red - else: - color = gray + last = self.get_field(key) + color = gray + try: + # logic for cell text coloring: up-green, down-red + if last < val: + color = fgreen + elif last > val: + color = red + except TypeError: + log.warn(f"wtf QT {val} is not regular?") cell = self.get_cell(key) # some displayable fields might have specifically