EasySci commited on
Commit
dc8d365
·
1 Parent(s): 0a49e9d

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +27 -3
app2.py CHANGED
@@ -1,4 +1,5 @@
1
  import panel as pn
 
2
 
3
  pn.extension('katex')
4
 
@@ -12,14 +13,30 @@ import TLDR
12
  from src.search import Search_Papers
13
 
14
  class MainBody(param.Parameterized):
 
15
  main_body = param.List(default=[pn.pane.LaTeX("Please select some tags!", styles={'font-size': '20pt'})])
16
 
17
- @param.depends("main_body")
 
18
  def update(self):
19
- return pn.Column(*self.main_body)
 
 
 
 
20
 
21
  main_body_instance = MainBody()
22
 
 
 
 
 
 
 
 
 
 
 
23
  paper_list = [] # Add this line to initialize paper_list as an empty list
24
 
25
  main_body = [pn.pane.LaTeX("Please select some tags!", styles={'font-size': '20pt'})]
@@ -66,6 +83,13 @@ buttons = pn.Column(
66
  def toggle_settings(event):
67
  buttons[-1].visible = event.new
68
 
 
 
 
 
 
 
 
69
  button3.param.watch(toggle_settings, 'value')
70
 
71
  # List to store the entered options
@@ -143,7 +167,7 @@ filter_list = pn.widgets.MultiChoice(
143
  template = pn.template.FastListTemplate(
144
  title="EasySciRead",
145
  header=[pn.Row(header_buttons, width=750, sizing_mode='stretch_width'), pn.Row(filter_list, width=250), pn.Row(add_to_header_button, width=55)],
146
- main= main_body_instance.update,
147
  sidebar=[buttons],
148
  accent_base_color="#88d8b0",
149
  header_background="#FFFFFF",
 
1
  import panel as pn
2
+ from panel import Tabs
3
 
4
  pn.extension('katex')
5
 
 
13
  from src.search import Search_Papers
14
 
15
  class MainBody(param.Parameterized):
16
+ active_tab = param.Parameter(default="Home")
17
  main_body = param.List(default=[pn.pane.LaTeX("Please select some tags!", styles={'font-size': '20pt'})])
18
 
19
+
20
+ @param.depends("active_tab", "main_body")
21
  def update(self):
22
+ return pn.Column(self.main_body)
23
+
24
+ # @param.depends("main_body")
25
+ # def update(self):
26
+ # return pn.Column(*self.main_body)
27
 
28
  main_body_instance = MainBody()
29
 
30
+ # Define the content for each tab
31
+ tab1_content = MainBody(main_body=[pn.pane.LaTeX("Home Tab Content", styles={'font-size': '20pt'})])
32
+ tab2_content = MainBody(main_body=[pn.pane.LaTeX("My Papers Tab Content", styles={'font-size': '20pt'})])
33
+
34
+ tabs = Tabs(
35
+ ("Home", tab1_content.update),
36
+ ("My Papers", tab2_content.update),
37
+ )
38
+
39
+
40
  paper_list = [] # Add this line to initialize paper_list as an empty list
41
 
42
  main_body = [pn.pane.LaTeX("Please select some tags!", styles={'font-size': '20pt'})]
 
83
  def toggle_settings(event):
84
  buttons[-1].visible = event.new
85
 
86
+
87
+ def switch_tab(event):
88
+ main_body_instance.active_tab = event.obj.name
89
+
90
+ button1.on_click(switch_tab)
91
+ button2.on_click(switch_tab)
92
+
93
  button3.param.watch(toggle_settings, 'value')
94
 
95
  # List to store the entered options
 
167
  template = pn.template.FastListTemplate(
168
  title="EasySciRead",
169
  header=[pn.Row(header_buttons, width=750, sizing_mode='stretch_width'), pn.Row(filter_list, width=250), pn.Row(add_to_header_button, width=55)],
170
+ main=tabs, # Use the Tabs widget here
171
  sidebar=[buttons],
172
  accent_base_color="#88d8b0",
173
  header_background="#FFFFFF",