2323from textual .signal import Signal
2424from textual .theme import Theme , BUILTIN_THEMES as TEXTUAL_THEMES
2525from textual .widget import Widget
26- from textual .widgets import (
27- Button ,
28- Footer ,
29- Input ,
30- Label ,
31- TextArea ,
32- )
26+ from textual .widgets import Button , Footer , Input , Label
3327from textual .widgets ._tabbed_content import ContentTab
34- from watchfiles import Change , awatch
3528from posting .collection import (
3629 Collection ,
3730 Cookie ,
4336
4437from posting .commands import PostingProvider
4538from posting .config import SETTINGS , Settings
46- from posting .help_screen import HelpScreen
4739from posting .jump_overlay import JumpOverlay
4840from posting .jumper import Jumper
4941from posting .scripts import execute_script , uncache_module , Posting as PostingContext
@@ -227,6 +219,7 @@ def compose(self) -> ComposeResult:
227219 yield collection_browser
228220 yield RequestEditor ()
229221 yield ResponseArea ()
222+
230223 yield Footer (show_command_palette = False )
231224
232225 def get_and_run_script (
@@ -618,8 +611,8 @@ def watch_expanded_section(
618611 request_editor .set_class (section == "response" , "hidden" )
619612 response_area .set_class (section == "request" , "hidden" )
620613
621- @on (TextArea .Changed , selector = "RequestBodyTextArea" )
622- def on_request_body_change (self , event : TextArea .Changed ) -> None :
614+ @on (RequestBodyTextArea .Changed , selector = "RequestBodyTextArea" )
615+ def on_request_body_change (self , event : RequestBodyTextArea .Changed ) -> None :
623616 """Update the body tab to indicate if there is a body."""
624617 body_tab = self .query_one ("#--content-tab-body-pane" , ContentTab )
625618 if event .text_area .text :
@@ -965,9 +958,19 @@ def __init__(
965958 _jumping : Reactive [bool ] = reactive (False , init = False , bindings = True )
966959 """True if 'jump mode' is currently active, otherwise False."""
967960
961+ def on_ready (self ) -> None :
962+ import time
963+ from posting ._start_time import START_TIME
964+
965+ message = f"Posting started in { (time .perf_counter_ns () - START_TIME ) // 1_000_000 } milliseconds."
966+ log .debug (message )
967+
968968 @work (exclusive = True , group = "environment-watcher" )
969969 async def watch_environment_files (self ) -> None :
970970 """Watching files that were passed in as the environment."""
971+
972+ from watchfiles import awatch
973+
971974 async for changes in awatch (* self .environment_files ):
972975 # Reload the variables from the environment files.
973976 load_variables (
@@ -993,6 +996,9 @@ async def watch_environment_files(self) -> None:
993996 @work (exclusive = True , group = "collection-watcher" )
994997 async def watch_collection_files (self ) -> None :
995998 """Watching specific files within the collection directory."""
999+
1000+ from watchfiles import awatch , Change
1001+
9961002 async for changes in awatch (self .collection .path ):
9971003 for change_type , file_path in changes :
9981004 if file_path .endswith (".py" ):
@@ -1021,6 +1027,9 @@ async def watch_collection_files(self) -> None:
10211027 @work (exclusive = True , group = "theme-watcher" )
10221028 async def watch_themes (self ) -> None :
10231029 """Watching the theme directory for changes."""
1030+
1031+ from watchfiles import awatch
1032+
10241033 async for changes in awatch (self .settings .theme_directory ):
10251034 for _change_type , file_path in changes :
10261035 if file_path .endswith ((".yml" , ".yaml" )):
@@ -1283,6 +1292,8 @@ def reset_focus(_) -> None:
12831292 self .screen .set_focus (focused )
12841293
12851294 self .set_focus (None )
1295+ from posting .help_screen import HelpScreen
1296+
12861297 await self .push_screen (HelpScreen (widget = focused ), callback = reset_focus )
12871298
12881299 def exit (
0 commit comments