kbberendsen commited on
Commit
7303a6b
1 Parent(s): 6166cea

remove sidebar module

Browse files
Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +18 -2
  3. modules/sidebar.py +0 -29
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -28,7 +28,22 @@ app_ui = ui.page_fluid(
28
  ui.panel_title("Gear usage in fastest lap"),
29
  ui.layout_sidebar(
30
  ui.panel_sidebar(
31
- sidebar.sidebar_content("sidebar_content")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ),
33
  ui.panel_main(
34
  ui.row(
@@ -72,7 +87,7 @@ def server(input, output, session):
72
  # Updating driver selection list
73
  @reactive.Effect()
74
  def _():
75
- if sidebar.sidebar_content("year") == "2023":
76
  driver_options = drivers_2023
77
  elif input.year() == "2022":
78
  driver_options = drivers_2022
@@ -126,6 +141,7 @@ def server(input, output, session):
126
  def get_data_2():
127
  try:
128
  ui.notification_show("Data takes a couple seconds to load.", duration=3, type = 'default')
 
129
  f1_session = ff1.get_session(int(input.year()), input.track_select(), input.session_type())
130
  f1_session.load()
131
 
 
28
  ui.panel_title("Gear usage in fastest lap"),
29
  ui.layout_sidebar(
30
  ui.panel_sidebar(
31
+ ui.input_select(
32
+ "track_select", "Select track:",
33
+ choices = ["Austria", "Hungary", "Spain", "Bahrain", "United-Kingdom"],
34
+ selected = "Austria"
35
+ ),
36
+ ui.input_radio_buttons(
37
+ "session_type", "Session type:",
38
+ choices = {"R": "Race", "Q": "Qualification"},
39
+ selected = "R"
40
+ ),
41
+ ui.input_radio_buttons(
42
+ "year", "Year:",
43
+ choices = ["2023", "2022"],
44
+ selected = "2023"
45
+ ),
46
+ width=2
47
  ),
48
  ui.panel_main(
49
  ui.row(
 
87
  # Updating driver selection list
88
  @reactive.Effect()
89
  def _():
90
+ if input.year() == "2023":
91
  driver_options = drivers_2023
92
  elif input.year() == "2022":
93
  driver_options = drivers_2022
 
141
  def get_data_2():
142
  try:
143
  ui.notification_show("Data takes a couple seconds to load.", duration=3, type = 'default')
144
+
145
  f1_session = ff1.get_session(int(input.year()), input.track_select(), input.session_type())
146
  f1_session.load()
147
 
modules/sidebar.py DELETED
@@ -1,29 +0,0 @@
1
- import os
2
- from shiny import module, App, ui, render, reactive
3
- import fastf1 as ff1
4
- import matplotlib.pyplot as plt
5
- from matplotlib.collections import LineCollection
6
- from matplotlib import cm
7
- import numpy as np
8
- import shinyswatch
9
-
10
- @module.ui
11
- def sidebar_content(id):
12
- return ui.div(
13
- ui.input_select(
14
- "track_select", "Select track:",
15
- choices = ["Austria", "Hungary", "Spain", "Bahrain", "United-Kingdom"],
16
- selected = "Austria"
17
- ),
18
- ui.input_radio_buttons(
19
- "session_type", "Session type:",
20
- choices = {"R": "Race", "Q": "Qualification"},
21
- selected = "R"
22
- ),
23
- ui.input_radio_buttons(
24
- "year", "Year:",
25
- choices = ["2023", "2022"],
26
- selected = "2023"
27
- ),
28
- width=2
29
- )