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

Public Member Functions

None __init__ (self, str|None name=None, str|None id=None, str|None classes=None)
 
 input_action (self, str new_config)
 
 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
 
- 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 94 of file file_io.py.

Constructor & Destructor Documentation

◆ __init__()

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

Reimplemented from file_io.__MenuWithButtons.

Definition at line 95 of file file_io.py.

95 def __init__(self, name: str | None = None, id: str | None = None, classes: str | None = None) -> None:
96
97 self._button_labels = {
98 "open" : {"label": "Open", "variant": "success"},
99 "browse" : {"label": "Browse [DOESN'T WORK]", "variant": "warning"}
100 }
101 """
102 Concrete class for opening a configuration file
103 """
104
105 super().__init__(self._button_labels, "Enter file path", name, id, classes)
106
107

Member Function Documentation

◆ button_actions()

file_io.OpenFile.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 118 of file file_io.py.

118 def button_actions(self, button_id: str | None):
119 """Open file or browse for file (not implemented)
120
121 Arguments:
122 button_id -- Button label
123 """
124 match button_id:
125 case "open":
126 input = self.query_one(Input)
127
128 # Safety check to avoid empty input
129 if input:
130 self.input_action(input.value)
131
132 case "browse":
133 logger = self._main_screen.query_one("RichLogWError")
134 logger.write_error("Sorry not done this yet, please enter full file path and hit enter/open!")
135 case _:
136 return
137
138

◆ input_action()

file_io.OpenFile.input_action ( self,
str new_config )
Add new handler based on config name

Reimplemented from file_io.__MenuWithButtons.

Definition at line 108 of file file_io.py.

108 def input_action(self, new_config: str):
109 """
110 Add new handler based on config name
111 """
112 try:
113 self._main_screen.update_with_new_input(new_config)
114 except Exception as e:
115 logger = self._main_screen.query_one("RichLogWError")
116 logger.write_error(e)
117

Member Data Documentation

◆ _button_labels

file_io.OpenFile._button_labels
protected
Initial value:
= {
"open" : {"label": "Open", "variant": "success"},
"browse" : {"label": "Browse [DOESN'T WORK]", "variant": "warning"}
}

Definition at line 97 of file file_io.py.


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