Skip to content

Commit

Permalink
remove fix_heights for good
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvris committed Nov 28, 2024
1 parent d8da0ee commit ca16184
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions kvui.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ def refresh_view_attrs(self, rv, index, data):
return super(SelectableLabel, self).refresh_view_attrs(
rv, index, data)

def refresh_view_layout(self, rv, index, layout, viewport):
super(SelectableLabel, self).refresh_view_layout(rv, index, layout, viewport)
self.height = self.texture_size[1]

def on_size(self, instance_label, size: list) -> None:
super().on_size(instance_label, size)
if self.parent:
Expand Down Expand Up @@ -390,9 +394,12 @@ def refresh_view_attrs(self, rv, index, data):
self.location_text = data["location"]["text"]
self.entrance_text = data["entrance"]["text"]
self.found_text = data["found"]["text"]
self.height = self.minimum_height
return super(HintLabel, self).refresh_view_attrs(rv, index, data)

def refresh_view_layout(self, rv, index, layout, viewport):
super(HintLabel, self).refresh_view_layout(rv, index, layout, viewport)
self.set_height(self, 0)

def on_touch_down(self, touch):
""" Add selection on touch down """
if super(HintLabel, self).on_touch_down(touch):
Expand Down Expand Up @@ -672,9 +679,6 @@ def add_client_tab(self, title: str, content: Widget) -> Widget:
return new_tab

def update_texts(self, dt):
if hasattr(self.tabs.carousel.slides[0], "fix_heights"):
self.tabs.carousel.slides[0].fix_heights() # TODO: remove this when Kivy fixes this upstream
# KIVYMDTODO: see if this bug exists in KivyMD
if self.ctx.server:
self.title = self.base_title + " " + Utils.__version__ + \
f" | Connected to: {self.ctx.server_address} " \
Expand Down Expand Up @@ -806,12 +810,6 @@ def clean_old(self):
if len(self.data) > self.messages:
self.data.pop(0)

def fix_heights(self):
"""Workaround fix for divergent texture and layout heights"""
for element in self.children[0].children:
if element.height != element.texture_size[1]:
element.height = element.texture_size[1]


class HintLog(MDRecycleView):
header = {
Expand All @@ -823,7 +821,7 @@ class HintLog(MDRecycleView):
"found": {"text": "[u]Status[/u]"},
"striped": True,
}

data: typing.List[typing.Any]
sort_key: str = ""
reversed: bool = False

Expand Down Expand Up @@ -867,12 +865,6 @@ def refresh_hints(self, hints):
def hint_sorter(element: dict) -> str:
return ""

def fix_heights(self):
"""Workaround fix for divergent texture and layout heights"""
for element in self.children[0].children:
max_height = max(child.texture_size[1] for child in element.children)
element.height = max_height


class E(ExceptionHandler):
logger = logging.getLogger("Client")
Expand Down

0 comments on commit ca16184

Please sign in to comment.