Skip to content

Commit 761f7d7

Browse files
authored
Merge pull request #75 from Textualize/fix-loading-local-documents
Fix loading local documents
2 parents d7e00f2 + 70f3bda commit 761f7d7

File tree

4 files changed

+53
-55
lines changed

4 files changed

+53
-55
lines changed

frogmouth/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
__credits__ = ["Dave Pearson"]
66
__maintainer__ = "Dave Pearson"
77
__email__ = "[email protected]"
8-
__version__ = "0.8.0"
8+
__version__ = "0.9.0"
99
__licence__ = "MIT"

frogmouth/widgets/viewer.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,17 @@ async def _local_load(self, location: Path, remember: bool = True) -> None:
188188
location: The location to load from.
189189
remember: Should we remember the location in th ehistory?
190190
"""
191-
# At the moment Textual's Markdown widget's load method captures
192-
# *all* exceptions and just returns a true/false. It would be
193-
# better to get an exception here and be able to properly report
194-
# the problem. Alas, right now, we can't.
195-
if await self.document.load(location):
196-
self._post_load(location, remember)
197-
else:
191+
try:
192+
await self.document.load(location)
193+
except OSError as error:
198194
self.app.push_screen(
199195
ErrorDialog(
200196
"Error loading local document",
201-
f"{location}\n\nThere was an error loading the document.",
197+
f"{location}\n\n{error}.",
202198
)
203199
)
200+
else:
201+
self._post_load(location, remember)
204202

205203
@work(exclusive=True)
206204
async def _remote_load(self, location: URL, remember: bool = True) -> None:

poetry.lock

+43-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "frogmouth"
33
homepage = "https://github.com/Textualize/frogmouth"
4-
version = "0.8.0"
4+
version = "0.9.0"
55
description = "A Markdown document viewer for the terminal"
66
authors = ["Dave Pearson <[email protected]>"]
77
license = "MIT"
@@ -28,14 +28,14 @@ classifiers = [
2828

2929
[tool.poetry.dependencies]
3030
python = "^3.8"
31-
textual = {version = ">=0.30.0"}
31+
textual = {version = "^0.32"}
3232
typing-extensions = "^4.5.0"
3333
httpx = "^0.24.1"
3434
xdg = "^6.0.0"
3535

3636

3737
[tool.poetry.group.dev.dependencies]
38-
textual-dev = "*"
38+
textual-dev = "^1.1"
3939
mypy = "^1.1.1"
4040
pylint = "^2.17.1"
4141
pre-commit = "^3.2.1"

0 commit comments

Comments
 (0)