Skip to content

fix: break circular layout dependency causing RecycleView infinite loop (fixes #124)#126

Open
RockyOmvi wants to merge 1 commit into
BusKill:font_settingfrom
RockyOmvi:font_setting
Open

fix: break circular layout dependency causing RecycleView infinite loop (fixes #124)#126
RockyOmvi wants to merge 1 commit into
BusKill:font_settingfrom
RockyOmvi:font_setting

Conversation

@RockyOmvi

Copy link
Copy Markdown

Summary

Fixes #124 - RecycleView infinite layout loop when changing font settings.

Root Cause

The BusKillOptionItem had a circular sizing dependency in buskill.kv:

  • BusKillOptionItem.height = labellayout.height + dp(10)
  • radio_button_label.height = labellayout.height
  • icon_label.height = labellayout.height
  • labellayout.text_size[0] = root.width - icon_label.width - radio_button_label.width

When a font setting changes:

  1. Icon/radio label texture size changes -> widths change
  2. labellayout.text_size changes -> text re-wraps -> height changes
  3. BusKillOptionItem.height changes -> grid re-layouts
  4. Kivy resizes children -> widths change again -> infinite loop

Changes

src/buskill.kv

  • Fixed size_hint from .25, None to 1, None
  • Removed height: labellayout.height from radio/icon labels
  • Changed text_size to fixed root.width - dp(100)

src/buskill_gui.py

  • Replaced Clock.schedule_once(self.rv.refresh_from_data, 0) with self.rv.data = list(self.rv.data) for deterministic single-pass refresh

…e loop

The BusKillOptionItem had a circular sizing dependency:
- item height = labellayout.height + dp(10)
- radio/icon label height = labellayout.height
- labellayout text_size width = root.width - icon_label.width - radio_button_label.width

This caused an infinite layout loop when font settings changed,
with Kivy logging 'unable to trigger refresh from data' repeatedly.

Fix: remove height bindings from radio/icon labels, use fixed estimate
for text_size width, and replace Clock.schedule_once refresh with
direct data list reassignment for deterministic single-pass refresh.

Fixes BusKill#124
Copilot AI review requested due to automatic review settings June 3, 2026 04:01
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

INFO: No unicode characters found in PR's commits

(source)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates UI refresh behavior and option-item layout sizing to improve how option state changes are reflected and displayed.

Changes:

  • Trigger RecycleView refresh by reassigning rv.data instead of scheduling refresh_from_data.
  • Adjust BusKillOptionItem sizing to use full width.
  • Replace dynamic text_size calculation with a fixed-width subtraction.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/buskill_gui.py Changes how the RecycleView is refreshed after mutating item dicts.
src/buskill.kv Updates option-item layout sizing and label wrapping behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/buskill_gui.py
Comment on lines +919 to +920
# trigger RecycleView refresh by replacing data list
self.rv.data = list(self.rv.data)
Comment thread src/buskill.kv
text: u'{0}\n[size=13sp][color=999999]{1}[/color][/size]'.format(root.option_human or root.value or '', root.desc or '')
font_size: '15sp'
text_size: root.width - icon_label.width - radio_button_label.width - (2*root.padding) - (2*root.spacing), None
text_size: root.width - dp(100), None
@maltfield

maltfield commented Jun 3, 2026

Copy link
Copy Markdown
Member

@Copilot you're not welcome here. How do I ban you from our repo?

Update: See also:

@maltfield

Copy link
Copy Markdown
Member

@RockyOmvi Thanks for the PR :)

Please note that this repo does not accept contributions that use AI

Can you please tell us if you wrote this code, comments, and PR contents entirely by yourself? Or if you used AI for any part of it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants