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

Public Member Functions

 compose (self)
 
 on_button_pressed (self, Button.Pressed event)
 
 add_object (self)
 
 dismiss_and_update (self)
 

Protected Attributes

 _main_screen = self.app.get_screen("main")
 
ConfigurationController _config_controller = self._main_screen.query_one(ConfigurationController)
 

Detailed Description

Definition at line 11 of file add_objects.py.

Member Function Documentation

◆ add_object()

add_objects.AddNewObject.add_object ( self)

Definition at line 33 of file add_objects.py.

33 def add_object(self):
34 input = self.query_one(Input)
35 selection = self.query_one(Select)
36
37 uid = input.value
38 config_class = selection.value
39
40 if uid and not selection.is_blank():
41 self._config_controller.add_new_conf_obj(config_class, uid)
42
43 self.dismiss_and_update()
44

◆ compose()

add_objects.AddNewObject.compose ( self)

Definition at line 12 of file add_objects.py.

12 def compose(self):
13 # Standard copy/paste
14 self._main_screen = self.app.get_screen("main")
15 self._config_controller: ConfigurationController = self._main_screen.query_one(ConfigurationController)
16
17 with Container(id="object_add_box"):
18 with Horizontal(id="select"):
19 yield Input(id="uid_input", placeholder="Object ID")
20 yield Select([(c, c) for c in self._config_controller.get_list_of_classes()],
21 id="class_select", allow_blank=True)
22 # with Horizontal(classes="buttons"):
23 # Add buttons
24 yield Button("Add Object", id="add_obj", variant="success")
25 yield Button("Cancel", id="cancel", variant="error")
26

◆ dismiss_and_update()

add_objects.AddNewObject.dismiss_and_update ( self)

Definition at line 45 of file add_objects.py.

45 def dismiss_and_update(self):
46 selection_menu = self._main_screen.query_exactly_one("SelectionPanel")
47 selection_menu.refresh(recompose=True)
48 selection_menu.restore_menu_state()
49 self.app.screen.dismiss()
50

◆ on_button_pressed()

add_objects.AddNewObject.on_button_pressed ( self,
Button.Pressed event )

Definition at line 27 of file add_objects.py.

27 def on_button_pressed(self, event: Button.Pressed):
28 if event.button.id=="add_obj":
29 self.add_object()
30 else:
31 self.app.screen.dismiss()
32

Member Data Documentation

◆ _config_controller

ConfigurationController add_objects.AddNewObject._config_controller = self._main_screen.query_one(ConfigurationController)
protected

Definition at line 15 of file add_objects.py.

◆ _main_screen

add_objects.AddNewObject._main_screen = self.app.get_screen("main")
protected

Definition at line 14 of file add_objects.py.


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