Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes cross selection disabled #3326

Merged
merged 1 commit into from
Apr 6, 2022
Merged

Fixes cross selection disabled #3326

merged 1 commit into from
Apr 6, 2022

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Apr 6, 2022

Fixes #3325

This is done by calling self._update_disabled at the end of __init__

image

This is done by calling self._update_disabled at the end of __init__
@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #3326 (64dd4b1) into master (fdbf05a) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3326      +/-   ##
==========================================
- Coverage   83.37%   83.35%   -0.03%     
==========================================
  Files         196      196              
  Lines       26541    26485      -56     
==========================================
- Hits        22129    22077      -52     
+ Misses       4412     4408       -4     
Impacted Files Coverage Δ
panel/widgets/select.py 94.89% <100.00%> (+0.52%) ⬆️
panel/pane/plotly.py 81.90% <0.00%> (-3.08%) ⬇️
panel/pane/base.py 88.00% <0.00%> (-0.89%) ⬇️
panel/tests/pane/test_plotly.py 98.58% <0.00%> (-0.20%) ⬇️
panel/models/perspective.py 100.00% <0.00%> (ø)
panel/pane/perspective.py 59.53% <0.00%> (+5.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 255f41c...64dd4b1. Read the comment docs.

@philippjfr
Copy link
Member

I'd just add on_init=True to the depends decorator on _update_disabled.

@hoxbro
Copy link
Member Author

hoxbro commented Apr 6, 2022

I tried that, but it didn't work because the widgets are not created yet.

AttributeError: 'CrossSelector' object has no attribute '_buttons'

Traceback (most recent call last):
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.8/site-packages/bokeh/application/handlers/code_runner.py", line 231, in run
    exec(self._code, module.__dict__)
  File "/home/shh/Development/holoviz/tmp.py", line 5, in <module>
    cross_selector = pn.widgets.CrossSelector(
  File "/home/shh/Development/holoviz/panel/panel/widgets/select.py", line 588, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/panel/panel/widgets/base.py", line 137, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/panel/panel/widgets/select.py", line 59, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/panel/panel/widgets/base.py", line 54, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/panel/panel/reactive.py", line 78, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/panel/panel/viewable.py", line 544, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/panel/panel/viewable.py", line 400, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/panel/panel/viewable.py", line 231, in __init__
    super().__init__(**params)
  File "/home/shh/Development/holoviz/param/param/parameterized.py", line 3170, in __init__
    self.param._update_deps(init=True)
  File "/home/shh/Development/holoviz/param/param/parameterized.py", line 1727, in _update_deps
    m()
  File "/home/shh/Development/holoviz/param/param/parameterized.py", line 400, in _depends
    return func(*args, **kw)
  File "/home/shh/Development/holoviz/panel/panel/widgets/select.py", line 648, in _update_disabled
    self._buttons[False].disabled = self.disabled
AttributeError: 'CrossSelector' object has no attribute '_buttons'

@philippjfr
Copy link
Member

Ah got it, need to be created before the constructor. This is fine, will merge.

@philippjfr philippjfr merged commit 0a4f1b9 into holoviz:master Apr 6, 2022
@hoxbro hoxbro deleted the cross_selection_disabled branch April 6, 2022 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CrossSelector does not respect disabled=True
2 participants