You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of expected behavior and the observed behavior
When the template main is a GridSpec I would expect to be able to update the GridSpec.
For example at awesome-panel.org I was trying to prepopulate a Template across pages to get a shared look and feel. But a few pages should look different and replace one or more of the prepopulated items.
Complete, minimal, self-contained example code that reproduces the issue
from panel.template import ReactTemplate
from panel.pane import Markdown
def test_grid_spec_replace():
template=ReactTemplate()
first = Markdown("I was here first")
template.main[0,0]=first
second=Markdown("But now I take over")
template.main[0,0]=second
return template
test_grid_spec_replace().servable()
$ 2020-11-04 06:21:39,386 Starting Bokeh server version 2.2.3 (running on Tornado 6.0.4)
2020-11-04 06:21:39,387 User authentication hooks NOT provided (default user enabled)
2020-11-04 06:21:39,390 Bokeh app running at: http://localhost:5006/script
2020-11-04 06:21:39,391 Starting Bokeh server with process id: 21168
WARNING:param.GridSpec00005: Specified region overlaps with the following existing object(s) in the grid:
(0, 0): Markdown(str)
The following shows a view of the grid (empty: 0, occupied: 1, overlapping: 2):
[[2 0 0 0 0 0 0 0 0 0 0 0]]
2020-11-04 06:21:47,318 Specified region overlaps with the following existing object(s) in the grid:
(0, 0): Markdown(str)
The following shows a view of the grid (empty: 0, occupied: 1, overlapping: 2):
[[2 0 0 0 0 0 0 0 0 0 0 0]]
2020-11-04 06:21:47,636 WebSocket connection opened
2020-11-04 06:21:47,637 ServerConnection created
Screenshots or screencasts of the bug in action
Additional Context
I simply don't understand why the changes to the different parameters of a BasicTemplate needs to trigger complicated updates. I believe instead that there should be one function to update and render the template when needed. That would be much easier. I also think the current implementation has a performance cost because there will potentially be a lot of complicated updates that could have been simplified to one.
The text was updated successfully, but these errors were encountered:
This is a similar example. But this time an exception is raised
frompanel.templateimportReactTemplatefrompanel.paneimportMarkdowndeftest_grid_spec_replace2():
template=ReactTemplate()
first=Markdown("I was here first")
template.main[0,0:12]=firstsecond=Markdown("But now I take over")
template.main[0,0:12]=secondreturntemplatetest_grid_spec_replace2().servable()
$ python -m panel serve 'script.py' --dev
2020-11-04 06:42:11,350 Starting Bokeh server version 2.2.3 (running on Tornado 6.0.4)
2020-11-04 06:42:11,351 User authentication hooks NOT provided (default user enabled)
2020-11-04 06:42:11,355 Bokeh app running at: http://localhost:5006/script
2020-11-04 06:42:11,355 Starting Bokeh server with process id: 21168
2020-11-04 06:42:16,549 404 GET /home?template=react&theme=default (::1) 1.03ms
WARNING:param.GridSpec00005: Specified region overlaps with the following existing object(s) in the grid:
(0, 0): Markdown(str)
The following shows a view of the grid (empty: 0, occupied: 1, overlapping: 2):
[[2 2 2 2 2 2 2 2 2 2 2 2]]
2020-11-04 06:42:22,961 Specified region overlaps with the following existing object(s) in the grid:
(0, 0): Markdown(str)
The following shows a view of the grid (empty: 0, occupied: 1, overlapping: 2):
[[2 2 2 2 2 2 2 2 2 2 2 2]]
2020-11-04 06:42:22,964 Error running application handler <bokeh.application.handlers.script.ScriptHandler object at 0x00000240A6FB9488>: (0, 0, 1, 12)
File "grid.py", line 463, in __setitem__:
del self.objects[dkey] Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Continuum\anaconda3\envs\panel_dev2\lib\site-packages\bokeh\application\handlers\code_runner.py", line 197, in run
exec(self._code, module.__dict__)
File "C:\repos\private\panel\script.py", line 11, in<module>test_grid_spec_replace2().servable()
File "C:\repos\private\panel\script.py", line 8, in test_grid_spec_replace2
template.main[0,0:12]=second
File "C:\repos\private\panel\panel\layout\grid.py", line 463, in __setitem__
del self.objects[dkey]
KeyError: (0, 0, 1, 12)
2020-11-04 06:42:23,045 WebSocket connection opened
2020-11-04 06:42:23,046 ServerConnection created
ALL software version info
Panel MASTER branch
Description of expected behavior and the observed behavior
When the template
main
is aGridSpec
I would expect to be able to update the GridSpec.For example at awesome-panel.org I was trying to prepopulate a Template across pages to get a shared look and feel. But a few pages should look different and replace one or more of the prepopulated items.
Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output
Screenshots or screencasts of the bug in action
Additional Context
I simply don't understand why the changes to the different parameters of a BasicTemplate needs to trigger complicated updates. I believe instead that there should be one function to
update
andrender
the template when needed. That would be much easier. I also think the current implementation has a performance cost because there will potentially be a lot of complicated updates that could have been simplified to one.The text was updated successfully, but these errors were encountered: