streamlit-component-loader 0.7.9__tar.gz → 0.7.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-component-loader
3
- Version: 0.7.9
3
+ Version: 0.7.11
4
4
  Summary: Components and Frameworks to give new features to streamlit
5
5
  Home-page: https://github.com/quiradev/streamlit-plugins
6
6
  Author: Victor Quilon Ranera
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-component-loader
3
- Version: 0.7.9
3
+ Version: 0.7.11
4
4
  Summary: Components and Frameworks to give new features to streamlit
5
5
  Home-page: https://github.com/quiradev/streamlit-plugins
6
6
  Author: Victor Quilon Ranera
@@ -1,6 +1,5 @@
1
1
  import inspect
2
2
  from abc import ABC, abstractmethod
3
- import atexit
4
3
  import time
5
4
  from enum import Enum, auto
6
5
  from typing import TypeVar, Callable, Tuple, Optional
@@ -4425,8 +4424,6 @@ class BaseLoader(ABC):
4425
4424
  )
4426
4425
  self.loader_container = loader_container
4427
4426
 
4428
- atexit.register(self.stop_loader)
4429
-
4430
4427
  def recreate_loader_with(self, **loader_kwargs) -> "LoaderType":
4431
4428
  return self.__class__(loader_container=self.loader_container, **loader_kwargs)
4432
4429
 
@@ -4446,10 +4443,11 @@ class DefaultLoader(BaseLoader):
4446
4443
  loader_container=None,
4447
4444
  label='', height=256,
4448
4445
  primary_color=None, background_color=None,
4449
- loader_lib: LoadersLib | Callable[..., Tuple[str, str ,str], ] = LoadersLib.book_loader, index=0, loader_lib_kwargs: dict = None
4446
+ loader_lib: LoadersLib | Callable[..., Tuple[str, str ,str], ] = LoadersLib.book_loader, index=0, loader_lib_kwargs: dict = None,
4447
+ sleep_animation_time: float = 0.1
4450
4448
  ):
4451
4449
  super().__init__(loader_container=loader_container)
4452
-
4450
+ self.sleep_animation_time = sleep_animation_time
4453
4451
  if primary_color is None:
4454
4452
  if st.get_option('theme.primaryColor') is None:
4455
4453
  primary_color = '#F63366'
@@ -4495,8 +4493,6 @@ class DefaultLoader(BaseLoader):
4495
4493
  self.display_element = st.empty()
4496
4494
  self.display_element_out = st.empty()
4497
4495
 
4498
- atexit.register(self.stop_loader)
4499
-
4500
4496
  @staticmethod
4501
4497
  def _parse_height_css(height: int | str) -> str:
4502
4498
  if isinstance(height, (int, float)):
@@ -4524,16 +4520,17 @@ class DefaultLoader(BaseLoader):
4524
4520
 
4525
4521
  with self.loader_container:
4526
4522
  self.display_element_out.empty()
4527
- time.sleep(0.2) # Pequeña pausa para evitar parpadeos
4523
+ if self.sleep_animation_time:
4524
+ time.sleep(self.sleep_animation_time) # Pequeña pausa para evitar parpadeos
4528
4525
  self.display_element.markdown(element_style+element_code, unsafe_allow_html=True)
4529
- time.sleep(5)
4530
4526
 
4531
4527
  def stop_loader(self):
4532
4528
  if self.running:
4533
4529
  with self.loader_container:
4534
4530
  self.display_element_out.markdown(self.element_out_style, unsafe_allow_html=True)
4535
4531
  # Para que se termine la animacion de salida y no se vea como parpadeos
4536
- time.sleep(0.3)
4532
+ if self.sleep_animation_time:
4533
+ time.sleep(self.sleep_animation_time)
4537
4534
  self.display_element.empty()
4538
4535
  self.display_element_out.empty()
4539
4536
  self.running = False