Skip to content

Commit

Permalink
Fixes for LoadingSpinner label and size (#5230)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Jul 6, 2023
1 parent 26cd453 commit c229467
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions panel/widgets/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)
from ..pane.markup import Str
from ..reactive import SyncableData
from ..util import escape, updating
from ..util import PARAM_NAME_PATTERN, escape, updating
from ..util.warnings import deprecated
from ..viewable import Viewable
from .base import Widget
Expand Down Expand Up @@ -171,16 +171,18 @@ class LoadingSpinner(BooleanIndicator):
def _process_param_change(self, msg):
msg = super()._process_param_change(msg)
if 'text' in msg:
msg['text'] = escape(f'<span><b>{msg["text"]}</b></span>')
text = msg.pop('text')
if not PARAM_NAME_PATTERN.match(text):
msg['text'] = escape(f'<span><b>{text}</b></span>')
value = msg.pop('value', None)
color = msg.pop('color', None)
bgcolor = msg.pop('bgcolor', None)
if msg.get('sizing_mode') == 'fixed':
msg['sizing_mode'] = None
if 'size' in msg or 'height' in msg:
if 'size' in msg or 'height' in msg or 'stylesheets' in msg:
if 'width' in msg and msg['width'] == msg.get('height'):
del msg['width']
size = int(min(msg.pop('height', float('inf')), msg.pop('size', 125)))
size = int(min(msg.pop('height', self.height) or float('inf'), msg.pop('size', self.size)))
msg['stylesheets'] = ([f':host {{ --loading-spinner-size: {size}px; }}'] +
msg.get('stylesheets', []))
msg['min_width'] = msg['min_height'] = size
Expand Down

0 comments on commit c229467

Please sign in to comment.