@@ -245,7 +245,7 @@ def __init__(self, *args, **kwargs):
245
245
super ().__init__ (* args , ** kwargs )
246
246
self .border_title = "Row Detail"
247
247
self ._dt = CustomTable (
248
- pl .DataFrame (),
248
+ pl .DataFrame ({ "Temp" : []} ),
249
249
pl .DataFrame ().with_row_index (name = INDEX_COL ).select ([INDEX_COL ]),
250
250
cursor_type = CustomTable .CursorType .NONE ,
251
251
)
@@ -461,7 +461,7 @@ async def watch_show_row_detail(self):
461
461
if not self .show_row_detail :
462
462
if existing := self .query (RowDetail ):
463
463
existing .remove ()
464
- else :
464
+ elif not self . _display_dt . is_empty () :
465
465
await self .query_one ("#main_hori" , Horizontal ).mount (self ._row_detail )
466
466
467
467
async def action_show_bookmarks (self ):
@@ -492,6 +492,8 @@ def _set_active_dt(self, active_dt: pl.DataFrame, new_row: int | None = None):
492
492
493
493
self ._display_dt = active_dt
494
494
self .cur_total_rows = len (self ._display_dt )
495
+ if self ._display_dt .is_empty ():
496
+ self .show_row_detail = False
495
497
self .watch_active_search (goto = False )
496
498
(table := self .query_one ("#main_table" , CustomTable )).set_dt (self ._display_dt , self ._meta_dt )
497
499
if new_row is not None :
@@ -529,9 +531,7 @@ async def watch_timestamp_columns(self):
529
531
).alias (self ._ts_col_names [x ])
530
532
for x in self .timestamp_columns
531
533
]
532
- print (calc_expr )
533
534
self ._original_dt = self ._original_dt .with_columns (calc_expr )
534
- print (self ._original_dt .columns )
535
535
except Exception as e :
536
536
self .notify (f"Failed to compute timestamp columns: { e } " , severity = "warn" , timeout = 5 )
537
537
finally :
@@ -614,18 +614,20 @@ def check_action(self, action: str, parameters: tuple[object, ...]) -> bool | No
614
614
if not edtq .has_focus and action in (x .action if isinstance (x , Binding ) else x [1 ] for x in DtBrowser .BINDINGS ):
615
615
return False
616
616
617
- if action == "iter_search" :
618
- if not self .active_search_queue :
619
- return False
620
- if bool (parameters [0 ]) and self .active_search_idx == len (self .active_search_queue ) - 1 :
621
- return False
622
- if not bool (parameters [0 ]) and self .active_search_idx == 0 :
623
- return False
624
- if action == "show_bookmarks" :
625
- return self ._bookmarks .has_bookmarks
626
-
627
- if action == "timestamp_selector" :
628
- return len (self ._ts_cols ) > 0
617
+ match action :
618
+ case "iter_search" :
619
+ if not self .active_search_queue :
620
+ return False
621
+ if bool (parameters [0 ]) and self .active_search_idx == len (self .active_search_queue ) - 1 :
622
+ return False
623
+ if not bool (parameters [0 ]) and self .active_search_idx == 0 :
624
+ return False
625
+ case "show_bookmarks" :
626
+ return self ._bookmarks .has_bookmarks
627
+ case "timestamp_selector" :
628
+ return len (self ._ts_cols ) > 0
629
+ case "toggle_row_detail" :
630
+ return not self ._display_dt .is_empty ()
629
631
630
632
return True
631
633
0 commit comments