Graphical User Interface
pages.home
This module defines the layout and callbacks for the home page of the reverberation optimization application. It includes components for inputting room parameters, defining room surfaces, and visualizing the calculated reverberation time.
add_row_to_surface_table(n_clicks, rows)
Add a new row to the surface definition table.
This callback is triggered when the "Add Row" button is clicked. It appends a new,
empty row to the area-table DataTable, allowing users to define another room surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_clicks
|
int
|
The number of times the 'add-row-button' has been clicked. |
required |
rows
|
list
|
The existing data in the 'area-table'. |
required |
Returns:
| Type | Description |
|---|---|
list
|
The updated data for the 'area-table' with the new row added. |
Source code in pages/home.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
handle_table_interactions(active_cell, close_clicks, modal_is_open, table_data)
Handle interactions with the main table.
This callback manages two user interactions: 1. Opens a material selection modal when the database icon ('💾') is clicked. 2. Deletes a row from the table when the delete icon ('🗑️') is clicked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
active_cell
|
dict
|
The currently active cell in the table. |
required |
close_clicks
|
int
|
Number of clicks on the close button. |
required |
modal_is_open
|
bool
|
Current state of the modal. |
required |
table_data
|
list
|
Current data in the table. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing the updated modal state, new modal content, updated table data, and the stored active row index. |
Source code in pages/home.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
update_area_table_with_material(active_cell, material_data, active_row_index, area_table_data)
Update the area table with data from the selected material of the material database.
This callback is triggered when a cell in the material selection modal table is clicked. It takes the absorption coefficient data from the selected material and populates the corresponding row in the main 'area-table'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
active_cell
|
dict
|
The activated cell in the 'material-selection-table'. |
required |
material_data
|
list
|
The data from the 'material-selection-table'. |
required |
active_row_index
|
int
|
The index of the row in 'area-table' to be updated. |
required |
area_table_data
|
list
|
The current data in the 'area-table'. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing the updated 'area-table' data and a boolean to close the modal. |
Source code in pages/home.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
update_graph_with_calculation(table_data, volume, height, temp, humidity, pressure, room_usage, air_damp_activated)
Update the graph based on all user inputs by calling the calculation module.
This callback gathers all room parameters and surface definitions from the user interface,
passes them to the reverberation_calc module for calculation, and plots the resulting
reverberation time on the graph. It also plots target reverberation time ranges based on
DIN 18041 if a room usage type is selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_data
|
list[dict]
|
Data from the surface definition table. |
required |
volume
|
float
|
Room volume in cubic meters. |
required |
height
|
float
|
Room height in meters. |
required |
temp
|
float
|
Room temperature in degrees Celsius. |
required |
humidity
|
float
|
Relative humidity in percent. |
required |
pressure
|
float
|
Air pressure in hPa. |
required |
room_usage
|
str
|
Selected room usage type from the dropdown. |
required |
air_damp_activated
|
bool
|
State of the air dampening toggle switch. |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
An updated Plotly figure with the calculated reverberation time. |
Source code in pages/home.py
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | |
validate_and_format_table_data(timestamp, data, data_previous)
Validate and format the data in the area-table. Ensures that area and alpha values are numeric and rounded to two decimal places. Reverts invalid inputs to their previous state.
Source code in pages/home.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |