Skip to content

Commit

Permalink
🔀 Merge pull request #134 from davep/become-enhanced
Browse files Browse the repository at this point in the history
Remove now-common code and depend on textual-enhanced
  • Loading branch information
davep authored Feb 3, 2025
2 parents f4b19bc + 03090b8 commit dd86f3e
Show file tree
Hide file tree
Showing 26 changed files with 122 additions and 842 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies = [
"humanize>=4.11.0",
"pyperclip>=1.9.0",
"typing-extensions>=4.12.2",
"textual-enhanced>=0.4.0",
]
readme = "README.md"
requires-python = ">= 3.10"
Expand Down Expand Up @@ -81,4 +82,4 @@ packages = ["src/braindrop"]

[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
asyncio_default_fixture_loop_scope = "function"
25 changes: 14 additions & 11 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ aiohttp-jinja2==1.6
# via textual-serve
aiosignal==1.3.2
# via aiohttp
anyio==4.7.0
anyio==4.8.0
# via httpx
attrs==24.3.0
attrs==25.1.0
# via aiohttp
certifi==2024.12.14
certifi==2025.1.31
# via httpcore
# via httpx
cfgv==3.4.0
Expand All @@ -33,7 +33,7 @@ click==8.1.8
# via textual-dev
distlib==0.3.9
# via virtualenv
filelock==3.16.1
filelock==3.17.0
# via virtualenv
frozenlist==1.5.0
# via aiohttp
Expand All @@ -46,7 +46,7 @@ httpx==0.28.1
# via braindrop
humanize==4.11.0
# via braindrop
identify==2.6.3
identify==2.6.6
# via pre-commit
idna==3.10
# via anyio
Expand Down Expand Up @@ -74,7 +74,7 @@ msgpack==1.1.0
multidict==6.1.0
# via aiohttp
# via yarl
mypy==1.14.0
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
nodeenv==1.9.1
Expand All @@ -86,18 +86,18 @@ platformdirs==4.3.6
# via virtualenv
pluggy==1.5.0
# via pytest
pre-commit==4.0.1
pre-commit==4.1.0
propcache==0.2.1
# via aiohttp
# via yarl
pygments==2.18.0
pygments==2.19.1
# via rich
pyperclip==1.9.0
# via braindrop
pytest==8.3.4
# via pytest-asyncio
pytest-asyncio==0.25.1
pytz==2024.2
pytest-asyncio==0.25.3
pytz==2025.1
# via braindrop
pyyaml==6.0.2
# via pre-commit
Expand All @@ -109,8 +109,11 @@ sniffio==1.3.1
textual==1.0.0
# via braindrop
# via textual-dev
# via textual-enhanced
# via textual-serve
textual-dev==1.7.0
textual-enhanced==0.4.0
# via braindrop
textual-serve==1.1.1
# via textual-dev
types-pytz==2024.2.0.20241221
Expand All @@ -121,7 +124,7 @@ typing-extensions==4.12.2
# via textual-dev
uc-micro-py==1.0.3
# via linkify-it-py
virtualenv==20.28.0
virtualenv==20.29.1
# via pre-commit
xdg-base-dirs==6.0.2
# via braindrop
Expand Down
11 changes: 7 additions & 4 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# universal: false

-e file:.
anyio==4.7.0
anyio==4.8.0
# via httpx
certifi==2024.12.14
certifi==2025.1.31
# via httpcore
# via httpx
h11==0.14.0
Expand All @@ -38,18 +38,21 @@ mdurl==0.1.2
# via markdown-it-py
platformdirs==4.3.6
# via textual
pygments==2.18.0
pygments==2.19.1
# via rich
pyperclip==1.9.0
# via braindrop
pytz==2024.2
pytz==2025.1
# via braindrop
rich==13.9.4
# via textual
sniffio==1.3.1
# via anyio
textual==1.0.0
# via braindrop
# via textual-enhanced
textual-enhanced==0.4.0
# via braindrop
typing-extensions==4.12.2
# via braindrop
# via textual
Expand Down
73 changes: 28 additions & 45 deletions src/braindrop/app/braindrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

##############################################################################
# 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.
from .. import __version__
from ..raindrop import API
from .data import (
ExitState,
Expand All @@ -22,53 +26,32 @@


##############################################################################
class Braindrop(App[ExitState]):
class Braindrop(EnhancedApp[ExitState]):
"""The Braindrop application class."""

CSS = """
CommandPalette > Vertical {
width: 75%; /* Full-width command palette looks like garbage. Fix that. */
background: $panel;
SearchIcon {
display: none;
}
OptionList {
/* Make the scrollbar less gross. */
scrollbar-background: $panel;
scrollbar-background-hover: $panel;
scrollbar-background-active: $panel;
}
}
/* 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;
}
HELP_TITLE = f"Braindrop v{__version__}"
HELP_ABOUT = """
`Braindrop` is a terminal-based client for
[raindrop.io](https://raindrop.io/); it was created by and is maintained
by [Dave Pearson](https://www.davep.org/); it is Free Software and can
be [found on GitHub](https://github.com/davep/braindrop).
"""
HELP_LICENSE = """
Braindrop - A client for the Raindrop bookmarking service. \n Copyright (C) 2024-2025 Dave Pearson
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
BINDINGS = [
Binding(
"ctrl+p, super+x, :",
"command_palette",
"Commands",
show=False,
tooltip="Show the command palette",
),
]
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
"""

COMMANDS = set()

Expand Down
6 changes: 0 additions & 6 deletions src/braindrop/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 .collection import (
SearchCollections,
ShowAll,
Expand All @@ -24,9 +23,7 @@
CompactMode,
Details,
Escape,
Help,
Logout,
Quit,
Redownload,
TagOrder,
VisitRaindrop,
Expand All @@ -43,7 +40,6 @@
##############################################################################
# Exports.
__all__ = [
"Command",
"AddRaindrop",
"ChangeTheme",
"CheckTheWaybackMachine",
Expand All @@ -54,9 +50,7 @@
"Details",
"EditRaindrop",
"Escape",
"Help",
"Logout",
"Quit",
"Redownload",
"Search",
"SearchCollections",
Expand Down
Loading

0 comments on commit dd86f3e

Please sign in to comment.