MaterialXWeb 0.0.2
Utilities for using MaterialX Packages with Web clients
Loading...
Searching...
No Matches
materialx_ocio_app.MaterialXFlaskApp Class Reference
Inheritance diagram for materialx_ocio_app.MaterialXFlaskApp:
materialx_ocio_app.materialx_ocio_app

Public Member Functions

 __init__ (self, home)
 
 run (self, host, port, debug=True)
 Run the Flask server with SocketIO.
 

Public Attributes

 home = home
 
 app = Flask(__name__)
 
 socketio = SocketIO(self.app)
 

Protected Member Functions

 _register_routes (self)
 Register HTTP routes.
 
 _setup_event_handler_map (self)
 Pure virtual method: Must be implemented by subclasses.
 
 _register_socket_events (self)
 Register SocketIO events.
 

Detailed Description

Definition at line 13 of file materialx_ocio_app.py.

Constructor & Destructor Documentation

◆ __init__()

materialx_ocio_app.MaterialXFlaskApp.__init__ ( self,
home )

Reimplemented in materialx_ocio_app.materialx_ocio_app.

Definition at line 14 of file materialx_ocio_app.py.

14 def __init__(self, home):
15 self.home = home
16
17 # Initialize Flask and SocketIO
18 self.app = Flask(__name__)
19 self.socketio = SocketIO(self.app)
20
21 # Register routes and events
22 self._register_routes()
23 self._setup_event_handler_map()
24 self._register_socket_events()
25

Member Function Documentation

◆ _register_routes()

materialx_ocio_app.MaterialXFlaskApp._register_routes ( self)
protected

Register HTTP routes.

Definition at line 26 of file materialx_ocio_app.py.

26 def _register_routes(self):
27 """
28 Register HTTP routes.
29 """
30 @self.app.route('/')
31 def home():
32 """
33 Render the home page.
34 """
35 #status_message = f'Startup: Using MaterialX version: {mx.getVersionString()}'
36 #self._emit_status_message(status_message)
37 return render_template(self.home)
38

◆ _register_socket_events()

materialx_ocio_app.MaterialXFlaskApp._register_socket_events ( self)
protected

Register SocketIO events.

Definition at line 43 of file materialx_ocio_app.py.

43 def _register_socket_events(self):
44 """
45 Register SocketIO events.
46 """
47 # Dynamically register event handlers
48 for event_name, handler in self.event_handlers.items():
49 self.socketio.on_event(event_name, handler)
50

◆ _setup_event_handler_map()

materialx_ocio_app.MaterialXFlaskApp._setup_event_handler_map ( self)
protected

Pure virtual method: Must be implemented by subclasses.

Reimplemented in materialx_ocio_app.materialx_ocio_app.

Definition at line 39 of file materialx_ocio_app.py.

39 def _setup_event_handler_map(self):
40 """Pure virtual method: Must be implemented by subclasses."""
41 raise NotImplementedError("Subclasses must implement _setup_event_handler_map")
42

◆ run()

materialx_ocio_app.MaterialXFlaskApp.run ( self,
host,
port,
debug = True )

Run the Flask server with SocketIO.

Definition at line 51 of file materialx_ocio_app.py.

51 def run(self, host, port, debug=True):
52 """
53 Run the Flask server with SocketIO.
54 """
55 self.socketio.run(self.app, host, port, debug=debug)
56
57

Member Data Documentation

◆ app

materialx_ocio_app.MaterialXFlaskApp.app = Flask(__name__)

Definition at line 18 of file materialx_ocio_app.py.

◆ home

materialx_ocio_app.MaterialXFlaskApp.home = home

Definition at line 15 of file materialx_ocio_app.py.

◆ socketio

materialx_ocio_app.MaterialXFlaskApp.socketio = SocketIO(self.app)

Definition at line 19 of file materialx_ocio_app.py.


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