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

Public Member Functions

 on_mount (self)
 
 set_initial_input_file (self, str input_file)
 
 update_with_new_input (self, str input_file_name)
 
 on_configuration_controller_changed (self, event)
 
None action_save_configuration (self)
 
None action_save_configuration_with_message (self)
 
None action_open_configuration (self)
 
None action_toggle_disable (self)
 
 call_quit_handler (self)
 
None action_request_quit (self)
 
 handle_sigint (self, signum, frame)
 
None action_modify_relations (self)
 
None action_add_configuration (self)
 
None action_destroy_configuration (self)
 
None action_rename_configuration (self)
 

Public Attributes

 logger = RichLogWError(id="main_log", highlight=True, markup=True)
 

Static Public Attributes

list BINDINGS
 

Static Protected Attributes

 _config_controller = None
 
 _init_input = None
 

Private Member Functions

 __make_logger (self, bool splash=False)
 

Detailed Description

Main screen for navigating python DBE

Definition at line 21 of file main_screen.py.

Member Function Documentation

◆ __make_logger()

main_screen.MainScreen.__make_logger ( self,
bool splash = False )
private

Definition at line 41 of file main_screen.py.

41 def __make_logger(self, splash: bool=False):
42 self.logger = RichLogWError(id="main_log", highlight=True, markup=True)
43
44 # Splash screen
45 if splash:
46 self.logger.write("[red]========================================================================")
47 self.logger.write(" [bold yellow]Welcome to CIDER![/bold yellow]")
48 self.logger.write(" [green]This is a work in progress, please use with[/green] [bold red]caution![/bold red]")
49 self.logger.write("[red]========================================================================\n\n")
50

◆ action_add_configuration()

None main_screen.MainScreen.action_add_configuration ( self)

Definition at line 162 of file main_screen.py.

162 async def action_add_configuration(self)->None:
163 try:
164 self.app.push_screen(AddNewObjectScreen())
165 except Exception as e:
166 self.query_one(RichLogWError).write_error(e)
167

◆ action_destroy_configuration()

None main_screen.MainScreen.action_destroy_configuration ( self)

Definition at line 168 of file main_screen.py.

168 async def action_destroy_configuration(self)->None:
169 try:
170 self.app.push_screen(DeleteConfigObjectScreen())
171 except Exception as e:
172 self.query_one(RichLogWError).write_error(e)
173

◆ action_modify_relations()

None main_screen.MainScreen.action_modify_relations ( self)

Definition at line 159 of file main_screen.py.

159 async def action_modify_relations(self)->None:
160 self.app.push_screen(ConfigObjectModifierScreen())
161

◆ action_open_configuration()

None main_screen.MainScreen.action_open_configuration ( self)
Activate open file splash screen

Definition at line 129 of file main_screen.py.

129 async def action_open_configuration(self) -> None:
130 """Activate open file splash screen
131 """
132 # Push the OpenFileScreen and wait for it to be closed
133 await self.app.push_screen(OpenFileScreen())
134

◆ action_rename_configuration()

None main_screen.MainScreen.action_rename_configuration ( self)

Definition at line 174 of file main_screen.py.

174 async def action_rename_configuration(self)->None:
175 self.app.push_screen(RenameConfigObjectScreen())
176

◆ action_request_quit()

None main_screen.MainScreen.action_request_quit ( self)
Quit TDBE

Definition at line 150 of file main_screen.py.

150 async def action_request_quit(self)->None:
151 """Quit TDBE
152 """
153 self.call_quit_handler()
154

◆ action_save_configuration()

None main_screen.MainScreen.action_save_configuration ( self)
Save current configuration

Definition at line 118 of file main_screen.py.

118 def action_save_configuration(self)->None:
119 """Save current configuration
120 """
121 config = self.query_one(ConfigurationController)
122 config.commit_configuration("Update configuration")
123

◆ action_save_configuration_with_message()

None main_screen.MainScreen.action_save_configuration_with_message ( self)
Save current configuration with an update message

Definition at line 124 of file main_screen.py.

124 def action_save_configuration_with_message(self)->None:
125 """Save current configuration with an update message
126 """
127 self.app.push_screen(SaveWithMessageScreen())
128

◆ action_toggle_disable()

None main_screen.MainScreen.action_toggle_disable ( self)
Toggle disable on the selected configuration object

Definition at line 135 of file main_screen.py.

135 async def action_toggle_disable(self)->None:
136 """Toggle disable on the selected configuration object
137 """
138 if self._config_controller.can_be_disabled():
139 await self.app.push_screen(SelectSessionScreen())
140
141 else:
142 # except:
143 self.query_one(RichLogWError).write_error("Could not toggle disable configuration object")
144
145

◆ call_quit_handler()

main_screen.MainScreen.call_quit_handler ( self)
Call the quit handler just like action_request_quit.

Definition at line 146 of file main_screen.py.

146 def call_quit_handler(self):
147 """Call the quit handler just like action_request_quit."""
148 self.app.push_screen(QuitScreen()) # Show the quit confirmation screen
149

◆ handle_sigint()

main_screen.MainScreen.handle_sigint ( self,
signum,
frame )

Definition at line 155 of file main_screen.py.

155 def handle_sigint(self, signum, frame):
156 # In the event quit is done with ctrl+c
157 self.call_quit_handler()
158

◆ on_configuration_controller_changed()

main_screen.MainScreen.on_configuration_controller_changed ( self,
event )
Updates table based on global state of the configuration controller

Definition at line 111 of file main_screen.py.

111 def on_configuration_controller_changed(self, event):
112 """Updates table based on global state of the configuration controller
113 """
114 config_table = self.query_one(ConfigTable)
115 if config_table is not None:
116 config_table.update_table(event.dal)
117

◆ on_mount()

main_screen.MainScreen.on_mount ( self)
Mount widgets with the logger appearing first

Definition at line 51 of file main_screen.py.

51 async def on_mount(self):
52 """Mount widgets with the logger appearing first"""
53 self.__make_logger(splash=True)
54 await self.mount(self.logger) # Mount the logger first
55
56 # Mount other widgets
57 if self._config_controller is None:
58 self._config_controller = ConfigurationController()
59 await self.mount(self._config_controller)
60 await self.mount(Footer())
61
62 if self._init_input is not None:
63 self.update_with_new_input(self._init_input)
64

◆ set_initial_input_file()

main_screen.MainScreen.set_initial_input_file ( self,
str input_file )

Definition at line 65 of file main_screen.py.

65 def set_initial_input_file(self, input_file: str):
66 self._init_input = input_file
67

◆ update_with_new_input()

main_screen.MainScreen.update_with_new_input ( self,
str input_file_name )
Update main screen to have a new input file.

Definition at line 68 of file main_screen.py.

68 def update_with_new_input(self, input_file_name: str):
69 '''
70 Update main screen to have a new input file.
71 '''
72 self._init_input = input_file_name
73
74 try:
75 self._config_controller.new_handler_from_str(input_file_name)
76 except Exception as e:
77 self.logger.write_error(e)
78 return
79
80 # Add interfaces
81 self._config_controller.add_interface("class-selection")
82 self._config_controller.add_interface("relation-selection")
83
84 # Mount the selection panel
85 try:
86 self.mount(SelectionPanel())
87 except Exception as e:
88 raise e
89
90 # Mount config table
91 try:
92 config_table = self.query_one(ConfigTable)
93 config_table.update_table(self._config_controller.current_dal)
94 except:
95 config_table = ConfigTable(id="main_table")
96 self.mount(config_table)
97
98 # Refresh the screen for safety
99 self.refresh()
100
101 # Get logger (defined at the start)
102
103 # Get the current database name
104 current_database_path = self._config_controller.configuration.databases[0]
105 data_base_name = path.basename(current_database_path)
106
107 # Print everything!
108 self.logger.write(f"[bold green]Opened new configuration file: [/bold green][bold red]{data_base_name}[/bold red][bold green].\nConnected databases are:[/bold green]\n" \
109 + "".join([f" - [red]{db}[/red] \n" for db in self._config_controller.configuration.get_includes()]))
110

Member Data Documentation

◆ _config_controller

main_screen.MainScreen._config_controller = None
staticprotected

Definition at line 38 of file main_screen.py.

◆ _init_input

main_screen.MainScreen._init_input = None
staticprotected

Definition at line 39 of file main_screen.py.

◆ BINDINGS

list main_screen.MainScreen.BINDINGS
static
Initial value:
= [
# Binding("ctrl+s", "save_configuration", "Save Configuration"),
Binding("ctrl+s", "save_configuration_with_message", "Save Configuration"),
Binding("o", "open_configuration", "Open Configuration"),
Binding("ctrl+q", "request_quit", "Exit Cider"),
Binding("e", "modify_relations", "Modify Relation to Object"),
Binding("r", "rename_configuration", "Rename Conf Object"),
Binding("d", "toggle_disable", "Toggle Disable"),
Binding("a", "add_configuration", "Add Conf Object"),
Binding("ctrl+d", "destroy_configuration", "Delete Conf Object"),
]

Definition at line 26 of file main_screen.py.

◆ logger

main_screen.MainScreen.logger = RichLogWError(id="main_log", highlight=True, markup=True)

Definition at line 42 of file main_screen.py.


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