DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
cider.widgets.config_table.ConfigTable Class Reference
Inheritance diagram for cider.widgets.config_table.ConfigTable:
[legend]
Collaboration diagram for cider.widgets.config_table.ConfigTable:
[legend]

Public Member Functions

 on_mount (self)
 
 compose (self)
 
 update_table (self, config_instance)
 
DataTable data_table (self)
 
None on_data_table_row_selected (self, DataTable.RowSelected event)
 

Protected Attributes

ConfigurationController _controller = main_screen.query_one("ConfigurationController")
 

Static Protected Attributes

 _data_table = DataTable()
 

Static Private Attributes

 __COLS = reactive([("Attribute", "Value", "Type", "Is Multivalue"), ("", "","","")])
 

Detailed Description

Definition at line 10 of file config_table.py.

Member Function Documentation

◆ compose()

cider.widgets.config_table.ConfigTable.compose ( self)

Definition at line 42 of file config_table.py.

42 def compose(self):
43 yield self._data_table
44

◆ data_table()

DataTable cider.widgets.config_table.ConfigTable.data_table ( self)

Definition at line 71 of file config_table.py.

71 def data_table(self)->DataTable:
72 return self._data_table
73

◆ on_data_table_row_selected()

None cider.widgets.config_table.ConfigTable.on_data_table_row_selected ( self,
DataTable.RowSelected event )
Edit cell when a row is selected

Definition at line 74 of file config_table.py.

74 def on_data_table_row_selected(self, event: DataTable.RowSelected) -> None:
75 """Edit cell when a row is selected"""
76 self.app.push_screen(EditCellScreen(event))
77

◆ on_mount()

cider.widgets.config_table.ConfigTable.on_mount ( self)
Initialise the table object

Definition at line 17 of file config_table.py.

17 def on_mount(self):
18 """Initialise the table object
19 """
20
21 # Grab main controller object
22 main_screen = self.app.get_screen("main")
23 self._controller: ConfigurationController = main_screen.query_one("ConfigurationController") #type: ignore
24
25 # Add default columns
26 for col in self.__COLS[0]:
27
28 width = 23
29 if col=="Value":
30 width = 60
31
32 self._data_table.add_column(col, width=width, key=col)
33
34 # Add dummy rows
35 self._data_table.add_rows(self.__COLS[1:])
36
37 # Some configuration to make it look "nice"
38 self._data_table.fixed_rows = 0
39 self._data_table.cursor_type = "row"
40 self._data_table.zebra_stripes=True
41

◆ update_table()

cider.widgets.config_table.ConfigTable.update_table ( self,
config_instance )
Updates table to display currently selected configuration object

Arguments:
    config_instance -- DAL configuration object

Definition at line 45 of file config_table.py.

45 def update_table(self, config_instance):
46 """Updates table to display currently selected configuration object
47
48 Arguments:
49 config_instance -- DAL configuration object
50 """
51
52 # Need to clear the table first
53 self._data_table.clear()
54
55 # Get attributes for DAL
56 attributes = self._controller.configuration.attributes(config_instance.className(), True)
57
58 # Loop over + dispaly attributes
59 for attr_name, attr_properties in attributes.items():
60 attr_val = getattr(config_instance, attr_name)
61
62 # If not set we still display the default value as defined in the schema
63 if attr_val=='':
64 attr_val = attr_properties['init-value']
65
66 # Dispalyattribute
67 else:
68 self._data_table.add_row(attr_name, attr_val, attr_properties['type'], attr_properties['multivalue'])
69

Member Data Documentation

◆ __COLS

cider.widgets.config_table.ConfigTable.__COLS = reactive([("Attribute", "Value", "Type", "Is Multivalue"), ("", "","","")])
staticprivate

Definition at line 13 of file config_table.py.

◆ _controller

ConfigurationController cider.widgets.config_table.ConfigTable._controller = main_screen.query_one("ConfigurationController")
protected

Definition at line 23 of file config_table.py.

◆ _data_table

cider.widgets.config_table.ConfigTable._data_table = DataTable()
staticprotected

Definition at line 15 of file config_table.py.


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