@@ -19,7 +19,8 @@ class EditTeamsScreen(ModalScreen):
1919
2020 BINDINGS = [
2121 ("escape" , "exit_screen" , "Exit" ),
22- ("d" , "delete_row" , "Delete Row" )
22+ ("ctrl+t" , "add_team" , "Add Team" ),
23+ ("ctrl+r" , "delete_team" , "Delete Team" )
2324 ]
2425
2526 def __init__ (self , columns , rows_with_keys , * args , ** kwargs ):
@@ -44,6 +45,7 @@ async def on_mount(self):
4445 # Polulate DataTable
4546 self .my_teams_table .clear (columns = True )
4647 self .my_teams_table .add_columns (* self .columns )
48+ self .my_teams_table .cursor_type = "row"
4749 for key_str , cell_values in self .rows_with_keys :
4850 self .my_teams_table .add_row (* cell_values , key = key_str )
4951 try :
@@ -67,6 +69,7 @@ async def on_mount(self):
6769 def row_selected (self , event : DataTable .RowSelected ):
6870 """ When the user selects a row in the data table store the row key"""
6971 self .row_key = event .row_key
72+ self .table = event .data_table
7073
7174 def action_exit_screen (self ):
7275 """ The user has requested to exit the screen, return the current table data """
@@ -75,7 +78,7 @@ def action_exit_screen(self):
7578 rows_with_keys .append ((row_key .value , self .my_teams_table .get_row (row_key )))
7679 self .dismiss (rows_with_keys )
7780
78- def action_delete_row (self ):
81+ def action_delete_team (self ):
7982 """ The user has selected the delete row option """
8083 self .log (f"Delete row selected, row key: { self .row_key } " )
8184 # If there is a row selected, delete it and clear the row key variable
@@ -89,3 +92,9 @@ def action_delete_row(self):
8992 else :
9093 self .teams_container .mount (Static ("Please select a row to delete prior to using the hot key!" ))
9194 self .teams_container .refresh (layout = True )
95+
96+ def action_add_team (self ):
97+ """ The user has selected the add team option """
98+ self .log ("Add team selected" )
99+ self .teams_container .mount (Static ("Add team functionality not yet implemented!" ))
100+ self .teams_container .refresh (layout = True )
0 commit comments