atodorov284 commited on
Commit
60d131d
·
1 Parent(s): 390e2d7

some refactoring

Browse files
streamlit_src/controllers/user_controller.py CHANGED
@@ -52,20 +52,16 @@ class UserController:
52
 
53
  self._two_columns_layout(0.7, self._raise_awareness, self._quiz)
54
 
55
- # Plot selection and rendering
56
- plot_type = self._view.view_option_selection(["Line Plot", "Gauge Plot"])
57
- if plot_type == "Line Plot":
58
- line_fig = self._prepare_line_plot()
59
- self._view.display_predictions_lineplot(line_fig)
60
- elif plot_type == "Gauge Plot":
61
- gauge_plots = self._prepare_gauge_plots()
62
- self._view.display_predictions_gaugeplot(gauge_plots)
63
 
64
- # WHO comparison
65
- who_comparisons = self._compare_to_who()
66
- self._view.compare_to_who(who_comparisons)
67
 
68
- # Sources
 
 
 
 
 
69
  sources = [
70
  (
71
  "WHO Air Quality Guidelines",
@@ -78,6 +74,26 @@ class UserController:
78
  ]
79
  self._view.print_sources(sources)
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  def _show_current_data(self) -> None:
82
  """
83
  Shows the current data on the main page of the user interface.
 
52
 
53
  self._two_columns_layout(0.7, self._raise_awareness, self._quiz)
54
 
55
+ self._display_plots()
 
 
 
 
 
 
 
56
 
57
+ self._display_compare_who()
 
 
58
 
59
+ self._display_sources()
60
+
61
+ def _display_sources(self) -> None:
62
+ """
63
+ Displays the sources on the main page of the user interface.
64
+ """
65
  sources = [
66
  (
67
  "WHO Air Quality Guidelines",
 
74
  ]
75
  self._view.print_sources(sources)
76
 
77
+ def _display_compare_who(self) -> None:
78
+ """
79
+ Displays the WHO comparison on the main page of the user interface.
80
+ """
81
+ who_comparisons = self._compare_to_who()
82
+ self._view.compare_to_who(who_comparisons)
83
+
84
+ def _display_plots(self) -> None:
85
+ """
86
+ Displays the plots on the main page of the user interface.
87
+ """
88
+ plot_type = self._view.view_option_selection(["Line Plot", "Gauge Plot"])
89
+
90
+ if plot_type == "Line Plot":
91
+ line_fig = self._prepare_line_plot()
92
+ self._view.display_predictions_lineplot(line_fig)
93
+ elif plot_type == "Gauge Plot":
94
+ gauge_plots = self._prepare_gauge_plots()
95
+ self._view.display_predictions_gaugeplot(gauge_plots)
96
+
97
  def _show_current_data(self) -> None:
98
  """
99
  Shows the current data on the main page of the user interface.