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)
### 1.1.1 (09-02-2025)
- Added bomb spinner widget for loading animation.
### 1.1.0 (23-01-2025)
- 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",
"versions": {
"1.1.1": {
"api_version": 9,
"commit_sha": "93106f2",
"released_on": "09-02-2025",
"md5sum": "0e5ec54582032a11c044d10cff3d0aa1"
},
"1.1.0": {
"api_version": 9,
"commit_sha": "004ee51",

View file

@ -29,7 +29,7 @@ from datetime import datetime
# Modules used for overriding AllSettingsWindow
import logging
PLUGIN_MANAGER_VERSION = "1.1.0"
PLUGIN_MANAGER_VERSION = "1.1.1"
REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager"
# Current tag can be changed to "staging" or any other branch in
# plugin manager repo for testing purpose.
@ -1746,21 +1746,26 @@ class PluginManagerWindow(bui.MainWindow):
parent=self._root_widget,
position=(-5, loading_pos_y),
size=(self._width, 25),
text="Loading",
text="",
color=bui.app.ui_v1.title_color,
scale=0.7,
h_align="center",
v_align="center",
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
def exception_handler(self):
try:
yield
except urllib.error.URLError:
self._dot_timer = None
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try:
bui.textwidget(
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.
pass
except Exception as e:
self._dot_timer = None
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try:
bui.textwidget(edit=self._plugin_manager_status_text, text=str(e))
except:
pass
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):
self.draw_search_bar()
self.draw_plugins_scroll_bar()
@ -1798,7 +1794,7 @@ class PluginManagerWindow(bui.MainWindow):
with self.exception_handler():
await self.plugin_manager.setup_changelog()
await self.plugin_manager.setup_index()
self._dot_timer = None
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try:
bui.textwidget(edit=self._plugin_manager_status_text, text="")
except:
@ -2115,18 +2111,18 @@ class PluginManagerWindow(bui.MainWindow):
async def refresh(self):
self.cleanup()
try:
bui.textwidget(edit=self._plugin_manager_status_text, text="Refreshing")
except:
pass
if self._dot_timer is None:
self._dot_timer = babase.AppTimer(0.5, self._update_dots, repeat=True)
# try:
# bui.textwidget(edit=self._plugin_manager_status_text, text="Refreshing")
# except:
# pass
bui.spinnerwidget(edit=self._loading_spinner, visible=True)
with self.exception_handler():
await self.plugin_manager.refresh()
await self.plugin_manager.setup_changelog()
await self.plugin_manager.setup_index()
self._dot_timer = None
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
try:
bui.textwidget(edit=self._plugin_manager_status_text, text="")
except: