Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

Textual 6.x's default stylesheet references $panel, causing TUI startup to fail with "reference to undefined variable '$panel'".

Changes

  • chatrixcd/tui.py: Added 'panel': theme['surface'] to ChatrixTUI.get_css_variables()
  • chatrixcd/tui_turbo.py: Added 'panel': theme['surface'] to ChatrixTurboTUI.get_css_variables()

Maps $panel to existing surface color for consistency across all themes (default, midnight, grayscale, windows31, msdos).

def get_css_variables(self) -> Dict[str, str]:
    theme = self.THEMES.get(self.theme_name, self.THEMES['default'])
    return {
        'primary': theme['primary'],
        'surface': theme['surface'],
        'background': theme['background'],
        'text': theme['text'],
        'text-muted': theme['text-muted'],
        'foreground': theme['text'],
        'panel': theme['surface'],  # Added for Textual 6.x
    }

Resolves startup failures with -t classic and -t turbo flags.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • semaphore.example.test
    • Triggering command: python3 -m unittest discover tests/ -v (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

(ChatrixCD) chatrix-web-sync:/ChatrixCD$ chatrixcd -t classic -N
Error in stylesheet:
/home/chatrix/ChatrixCD/.venv/lib/python3.12/site-packages/textual/app.py, App.DEFAULT_CSS:40:26
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 38 │ │ Screen.-maximized-view { │
│ 39 │ │ │ layout: vertical !important; │
│ ❱ 40 │ │ │ hatch: right $panel; │
│ 41 │ │ │ overflow-y: auto !important; │
│ 42 │ │ │ align: center middle; │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
• reference to undefined variable '$panel'
(ChatrixCD) chatrix-web-sync:
/ChatrixCD$ chatrixcd -tturbo -N
Error in stylesheet:
/home/chatrix/ChatrixCD/.venv/lib/python3.12/site-packages/textual/app.py, App.DEFAULT_CSS:40:26
• reference to undefined variable '$panel'

Error in TUI(s)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: CJFWeatherhead <6923098+CJFWeatherhead@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error in stylesheet for classic theme Fix Textual 6.x CSS compatibility: add missing $panel variable Nov 3, 2025
Copilot AI requested a review from CJFWeatherhead November 3, 2025 00:25
@CJFWeatherhead CJFWeatherhead marked this pull request as ready for review November 3, 2025 00:29
Copilot AI review requested due to automatic review settings November 3, 2025 00:29
@CJFWeatherhead CJFWeatherhead merged commit 402b1f7 into main Nov 3, 2025
7 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a compatibility issue with Textual 6.x that was causing a stylesheet error when starting the TUI with classic or turbo themes. The fix adds a missing CSS variable mapping.

Key changes:

  • Added $panel CSS variable mapping to both TUI implementations for Textual 6.x compatibility
  • Updated CHANGELOG.md to document the fix

Reviewed Changes

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

File Description
chatrixcd/tui_turbo.py Added panel CSS variable mapping to surface theme color in get_css_variables()
chatrixcd/tui.py Added panel CSS variable mapping to surface theme color in get_css_variables()
CHANGELOG.md Documented the TUI compatibility fix for Textual 6.x

@CJFWeatherhead CJFWeatherhead deleted the copilot/fix-stylesheet-error branch November 8, 2025 17:39
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.

2 participants