Added bomb spinner for loading animation

This commit is contained in:
brostos 2025-02-09 17:05:56 +03:00 committed by GitHub
commit 4ab37f302b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 22 deletions

View file

@ -1,5 +1,9 @@
## Plugin Manager (dd-mm-yyyy) ## Plugin Manager (dd-mm-yyyy)
### 1.1.1 (09-02-2025)
- Added bomb spinner widget for loading animation.
### 1.1.0 (23-01-2025) ### 1.1.0 (23-01-2025)
- Updated to bombsquad api 9. - Updated to bombsquad api 9.

View file

@ -1,6 +1,12 @@
{ {
"plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py", "plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py",
"versions": { "versions": {
"1.1.1": {
"api_version": 9,
"commit_sha": "93106f2",
"released_on": "09-02-2025",
"md5sum": "0e5ec54582032a11c044d10cff3d0aa1"
},
"1.1.0": { "1.1.0": {
"api_version": 9, "api_version": 9,
"commit_sha": "004ee51", "commit_sha": "004ee51",

View file

@ -29,7 +29,7 @@ from datetime import datetime
# Modules used for overriding AllSettingsWindow # Modules used for overriding AllSettingsWindow
import logging import logging
PLUGIN_MANAGER_VERSION = "1.1.0" PLUGIN_MANAGER_VERSION = "1.1.1"
REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager" REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager"
# Current tag can be changed to "staging" or any other branch in # Current tag can be changed to "staging" or any other branch in
# plugin manager repo for testing purpose. # plugin manager repo for testing purpose.
@ -1746,21 +1746,26 @@ class PluginManagerWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
position=(-5, loading_pos_y), position=(-5, loading_pos_y),
size=(self._width, 25), size=(self._width, 25),
text="Loading", text="",
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
scale=0.7, scale=0.7,
h_align="center", h_align="center",
v_align="center", v_align="center",
maxwidth=400, maxwidth=400,
) )
self._dot_timer = babase.AppTimer(0.5, self._update_dots, repeat=True) self._loading_spinner = bui.spinnerwidget(
parent=self._root_widget,
position=(self._width * 0.5, loading_pos_y),
style='bomb',
size=48,
)
@contextlib.contextmanager @contextlib.contextmanager
def exception_handler(self): def exception_handler(self):
try: try:
yield yield
except urllib.error.URLError: except urllib.error.URLError:
self._dot_timer = None bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try: try:
bui.textwidget( bui.textwidget(
edit=self._plugin_manager_status_text, edit=self._plugin_manager_status_text,
@ -1773,22 +1778,13 @@ class PluginManagerWindow(bui.MainWindow):
# User probably went back before a bui.Window could finish loading. # User probably went back before a bui.Window could finish loading.
pass pass
except Exception as e: except Exception as e:
self._dot_timer = None bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try: try:
bui.textwidget(edit=self._plugin_manager_status_text, text=str(e)) bui.textwidget(edit=self._plugin_manager_status_text, text=str(e))
except: except:
pass pass
raise raise
def _update_dots(self):
try:
text = cast(str, bui.textwidget(query=self._plugin_manager_status_text))
if text.endswith('....'):
text = text[0:len(text)-4]
bui.textwidget(edit=self._plugin_manager_status_text, text=(text + '.'))
except:
pass
async def draw_index(self): async def draw_index(self):
self.draw_search_bar() self.draw_search_bar()
self.draw_plugins_scroll_bar() self.draw_plugins_scroll_bar()
@ -1798,7 +1794,7 @@ class PluginManagerWindow(bui.MainWindow):
with self.exception_handler(): with self.exception_handler():
await self.plugin_manager.setup_changelog() await self.plugin_manager.setup_changelog()
await self.plugin_manager.setup_index() await self.plugin_manager.setup_index()
self._dot_timer = None bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try: try:
bui.textwidget(edit=self._plugin_manager_status_text, text="") bui.textwidget(edit=self._plugin_manager_status_text, text="")
except: except:
@ -2115,18 +2111,18 @@ class PluginManagerWindow(bui.MainWindow):
async def refresh(self): async def refresh(self):
self.cleanup() self.cleanup()
try: # try:
bui.textwidget(edit=self._plugin_manager_status_text, text="Refreshing") # bui.textwidget(edit=self._plugin_manager_status_text, text="Refreshing")
except: # except:
pass # pass
if self._dot_timer is None:
self._dot_timer = babase.AppTimer(0.5, self._update_dots, repeat=True) bui.spinnerwidget(edit=self._loading_spinner, visible=True)
with self.exception_handler(): with self.exception_handler():
await self.plugin_manager.refresh() await self.plugin_manager.refresh()
await self.plugin_manager.setup_changelog() await self.plugin_manager.setup_changelog()
await self.plugin_manager.setup_index() await self.plugin_manager.setup_index()
self._dot_timer = None bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try: try:
bui.textwidget(edit=self._plugin_manager_status_text, text="") bui.textwidget(edit=self._plugin_manager_status_text, text="")
except: except: