mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix devtools run
This commit is contained in:
@@ -130,7 +130,7 @@ class BasicApp(App, css_path="basic.css"):
|
||||
classes="scrollable",
|
||||
),
|
||||
table,
|
||||
Widget(DirectoryTree("~/projects/textual"), id="tree-container"),
|
||||
Widget(DirectoryTree("~/"), id="tree-container"),
|
||||
Error(),
|
||||
Tweet(TweetBody(), classes="scrollbar-size-custom"),
|
||||
Warning(),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import runpy
|
||||
from typing import cast, TYPE_CHECKING
|
||||
|
||||
from importlib_metadata import version
|
||||
@@ -57,16 +59,12 @@ def import_app(import_name: str) -> App:
|
||||
lib, _colon, name = import_name.partition(":")
|
||||
|
||||
if lib.endswith(".py"):
|
||||
# We're assuming the user wants to load a .py file
|
||||
path = os.path.abspath(lib)
|
||||
try:
|
||||
with open(lib) as python_file:
|
||||
py_code = python_file.read()
|
||||
global_vars = runpy.run_path(path)
|
||||
except Exception as error:
|
||||
raise AppFail(str(error))
|
||||
|
||||
global_vars: dict[str, object] = {}
|
||||
exec(py_code, global_vars)
|
||||
|
||||
if name:
|
||||
# User has given a name, use that
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user