Skip to content

Commit

Permalink
Added bomb spinner for loading animation
Browse files Browse the repository at this point in the history
  • Loading branch information
brostosjoined authored Feb 9, 2025
2 parents b0f6846 + 892c9c8 commit 4ab37f3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 6 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
40 changes: 18 additions & 22 deletions plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# 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.
Expand Down Expand Up @@ -1746,21 +1746,26 @@ def __init__(self, transition: str = "in_right", origin_widget: bui.Widget = Non
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,
Expand All @@ -1773,22 +1778,13 @@ def exception_handler(self):
# 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()
Expand All @@ -1798,7 +1794,7 @@ async def draw_index(self):
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:
Expand Down Expand Up @@ -2115,18 +2111,18 @@ def cleanup(self):

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:
Expand Down

0 comments on commit 4ab37f3

Please sign in to comment.