DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
file_io.RenameConfigObject Class Reference
Inheritance diagram for file_io.RenameConfigObject:
[legend]
Collaboration diagram for file_io.RenameConfigObject:
[legend]

Public Member Functions

None __init__ (self, str|None name=None, str|None id=None, str|None classes=None)
 
 input_action (self, str new_file_name)
 
 button_actions (self, str|None button_id)
 
- Public Member Functions inherited from file_io.__MenuWithButtons
 compose (self)
 
 on_input_submitted (self, event)
 
 on_button_pressed (self, Button.Pressed event)
 

Protected Attributes

dict _button_labels
 
 _input_message = getattr(self._config_controller.current_dal, "id")
 
- Protected Attributes inherited from file_io.__MenuWithButtons
 _button_labels = button_labels
 
 _main_screen = self.app.get_screen("main")
 
 _config_controller = self._main_screen.query_one(ConfigurationController)
 
 _input_message = input_message
 

Detailed Description

Definition at line 164 of file file_io.py.

Constructor & Destructor Documentation

◆ __init__()

None file_io.RenameConfigObject.__init__ ( self,
str | None name = None,
str | None id = None,
str | None classes = None )

Reimplemented from file_io.__MenuWithButtons.

Definition at line 165 of file file_io.py.

165 def __init__(self, name: str | None = None, id: str | None = None, classes: str | None = None) -> None:
166
167 self._button_labels = {
168 "rename" : {"label": "Rename", "variant": "success"}
169 }
170 """
171 Concrete class for opening a configuration file
172 """
173
174 super().__init__(self._button_labels, "", name, id, classes)
175
176 # Bit hacky but "shrug"
177 self._input_message = getattr(self._config_controller.current_dal, "id")
178
179

Member Function Documentation

◆ button_actions()

file_io.RenameConfigObject.button_actions ( self,
str | None button_id )
Open file or browse for file (not implemented)

Arguments:
    button_id -- Button label

Reimplemented from file_io.__MenuWithButtons.

Definition at line 195 of file file_io.py.

195 def button_actions(self, button_id: str | None):
196 """Open file or browse for file (not implemented)
197
198 Arguments:
199 button_id -- Button label
200 """
201 match button_id:
202 case "rename":
203 input = self.query_one(Input)
204
205 # Safety check to avoid empty input
206 if input:
207 self.input_action(input.value)
208
209 case _:
210 return
211

◆ input_action()

file_io.RenameConfigObject.input_action ( self,
str new_file_name )
Add new handler based on config name

Reimplemented from file_io.__MenuWithButtons.

Definition at line 180 of file file_io.py.

180 def input_action(self, new_file_name: str):
181 """
182 Add new handler based on config name
183 """
184 try:
185 self._config_controller.rename_dal(new_file_name)
186 main_screen = self.app.get_screen("main")
187 selection_menu = main_screen.query_exactly_one("SelectionPanel")
188 selection_menu.refresh(recompose=True)
189 selection_menu.restore_menu_state()
190
191 except Exception as e:
192 logger = self._main_screen.query_one("RichLogWError")
193 logger.write_error(e)
194

Member Data Documentation

◆ _button_labels

file_io.RenameConfigObject._button_labels
protected
Initial value:
= {
"rename" : {"label": "Rename", "variant": "success"}
}

Definition at line 167 of file file_io.py.

◆ _input_message

file_io.RenameConfigObject._input_message = getattr(self._config_controller.current_dal, "id")
protected

Definition at line 177 of file file_io.py.


The documentation for this class was generated from the following file: