Skip to content

Commit

Permalink
🔨 Move a load of code out into textual-enhanced
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Feb 1, 2025
1 parent 64df011 commit 32c8104
Show file tree
Hide file tree
Showing 28 changed files with 89 additions and 573 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies = [
"packaging>=24.2",
"humanize>=4.11.0",
"textual-fspicker>=0.2.0",
"textual-enhanced>=0.1.0",
]
readme = "README.md"
requires-python = ">= 3.9"
Expand Down
3 changes: 3 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ sniffio==1.3.1
textual==1.0.0
# via peplum
# via textual-dev
# via textual-enhanced
# via textual-fspicker
# via textual-serve
textual-dev==1.7.0
textual-enhanced==0.1.0
# via peplum
textual-fspicker==0.2.0
# via peplum
textual-serve==1.1.1
Expand Down
3 changes: 3 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ sniffio==1.3.1
# via anyio
textual==1.0.0
# via peplum
# via textual-enhanced
# via textual-fspicker
textual-enhanced==0.1.0
# via peplum
textual-fspicker==0.2.0
# via peplum
typing-extensions==4.12.2
Expand Down
2 changes: 0 additions & 2 deletions src/peplum/app/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

##############################################################################
# Local imports.
from .base import Command
from .filtering import (
Search,
SearchAuthor,
Expand Down Expand Up @@ -38,7 +37,6 @@
##############################################################################
# Exports.
__all__ = [
"Command",
"ChangeTheme",
"EditNotes",
"Escape",
Expand Down
171 changes: 0 additions & 171 deletions src/peplum/app/commands/base.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/peplum/app/commands/filtering.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Provides command-oriented messages that relate to filtering."""

##############################################################################
# Local imports.
from .base import Command
# Textual enhanced imports.
from textual_enhanced.commands import Command


##############################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/peplum/app/commands/finding.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Commands related to finding things."""

##############################################################################
# Local imports.
from .base import Command
# Textual enhanced imports.
from textual_enhanced.commands import Command


##############################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/peplum/app/commands/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""The main commands used within the application."""

##############################################################################
# Local imports.
from .base import Command
# Textual enhanced imports.
from textual_enhanced.commands import Command


##############################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/peplum/app/commands/navigation_sorting.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Commands for affecting navigation sort ordering."""

##############################################################################
# Local imports.
from .base import Command
# Textual enhanced imports.
from textual_enhanced.commands import Command


##############################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/peplum/app/commands/peps_sorting.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Provides command-oriented messages that relate to sorting PEPs."""

##############################################################################
# Local imports.
from .base import Command
# Textual enhanced imports.
from textual_enhanced.commands import Command


##############################################################################
Expand Down
53 changes: 6 additions & 47 deletions src/peplum/app/peplum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

##############################################################################
# Textual imports.
from textual.app import App, InvalidThemeError
from textual.binding import Binding
from textual.app import InvalidThemeError

##############################################################################
# Textual enhanced imports.
from textual_enhanced.app import EnhancedApp

##############################################################################
# Local imports.
Expand All @@ -15,53 +18,9 @@


##############################################################################
class Peplum(App[None]):
class Peplum(EnhancedApp[None]):
"""The main application class."""

CSS = """
CommandPalette > Vertical {
width: 75%; /* Full-width command palette looks like garbage. Fix that. */
background: $panel;
SearchIcon {
display: none;
}
}
/* Make the LoadingIndicator look less like it was just slapped on. */
LoadingIndicator {
background: transparent;
}
/* Remove cruft from the Header. */
Header {
/* The header icon is ugly and pointless. Remove it. */
HeaderIcon {
visibility: hidden;
}
/* The tall version of the header is utterly useless. Nuke that. */
&.-tall {
height: 1 !important;
}
}
/* General style tweaks that affect all widgets. */
* {
/* Let's make scrollbars a wee bit thinner. */
scrollbar-size-vertical: 1;
}
"""

BINDINGS = [
Binding(
"ctrl+p, super+x, :",
"command_palette",
"Commands",
show=False,
tooltip="Show the command palette",
),
]

COMMANDS = set()

def __init__(self) -> None:
Expand Down
2 changes: 0 additions & 2 deletions src/peplum/app/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
##############################################################################
# Local imports.
from .authors import AuthorCommands
from .commands_provider import CommandsProvider
from .main import MainCommands
from .peps import PEPsCommands
from .python_versions import PythonVersionCommands
Expand All @@ -14,7 +13,6 @@
# Exports.
__all__ = [
"AuthorCommands",
"CommandsProvider",
"MainCommands",
"PEPsCommands",
"PythonVersionCommands",
Expand Down
5 changes: 4 additions & 1 deletion src/peplum/app/providers/authors.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"""Author filtering commands for the command palette."""

##############################################################################
# Textual enhanced imports.
from textual_enhanced.commands import CommandHit, CommandHits, CommandsProvider

##############################################################################
# Local imports.
from ..data import PEPs
from ..messages import ShowAuthor
from .commands_provider import CommandHit, CommandHits, CommandsProvider


##############################################################################
Expand Down
Loading

0 comments on commit 32c8104

Please sign in to comment.