mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
Add files via upload
This commit is contained in:
parent
656e59ab0b
commit
4eea3ca298
1 changed files with 76 additions and 58 deletions
|
|
@ -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.2"
|
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.
|
||||||
|
|
@ -1760,12 +1760,17 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
size=48,
|
size=48,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def spin(self,show=False):
|
||||||
|
w = self._loading_spinner
|
||||||
|
p = self._root_widget
|
||||||
|
bui.spinnerwidget(w,visible=show) if w.exists() and p.exists() and not p.transitioning_out else None
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def exception_handler(self):
|
def exception_handler(self):
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
except urllib.error.URLError:
|
except urllib.error.URLError:
|
||||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
self.spin()
|
||||||
try:
|
try:
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
edit=self._plugin_manager_status_text,
|
edit=self._plugin_manager_status_text,
|
||||||
|
|
@ -1778,7 +1783,7 @@ 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:
|
||||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
self.spin()
|
||||||
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:
|
||||||
|
|
@ -1794,7 +1799,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()
|
||||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
self.spin()
|
||||||
try:
|
try:
|
||||||
bui.textwidget(edit=self._plugin_manager_status_text, text="")
|
bui.textwidget(edit=self._plugin_manager_status_text, text="")
|
||||||
except:
|
except:
|
||||||
|
|
@ -1840,9 +1845,11 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
textcolor=b_textcolor,
|
textcolor=b_textcolor,
|
||||||
text_scale=0.6)
|
text_scale=0.6)
|
||||||
else:
|
else:
|
||||||
bui.buttonwidget(edit=self.alphabet_order_selection_button,
|
b = self.alphabet_order_selection_button
|
||||||
|
bui.buttonwidget(
|
||||||
|
edit=b,
|
||||||
label=('Z - A' if self.selected_alphabet_order == 'z_a' else 'A - Z')
|
label=('Z - A' if self.selected_alphabet_order == 'z_a' else 'A - Z')
|
||||||
)
|
) if b.exists() else None
|
||||||
|
|
||||||
label = f"Category: {post_label}"
|
label = f"Category: {post_label}"
|
||||||
|
|
||||||
|
|
@ -1857,8 +1864,11 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
text_scale=0.6)
|
text_scale=0.6)
|
||||||
bui.buttonwidget(b,on_activate_call=lambda: self.show_categories_window(source=b)),
|
bui.buttonwidget(b,on_activate_call=lambda: self.show_categories_window(source=b)),
|
||||||
else:
|
else:
|
||||||
self.category_selection_button = bui.buttonwidget(edit=self.category_selection_button,
|
b = self.category_selection_button
|
||||||
label=label)
|
bui.buttonwidget(
|
||||||
|
edit=b,
|
||||||
|
label=label
|
||||||
|
) if b.exists() else None
|
||||||
|
|
||||||
async def _on_order_button_press(self) -> None:
|
async def _on_order_button_press(self) -> None:
|
||||||
self.selected_alphabet_order = ('a_z' if self.selected_alphabet_order == 'z_a' else 'z_a')
|
self.selected_alphabet_order = ('a_z' if self.selected_alphabet_order == 'z_a' else 'z_a')
|
||||||
|
|
@ -1965,19 +1975,22 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
refresh_pos_y = (180 if _uiscale is babase.UIScale.SMALL else
|
refresh_pos_y = (180 if _uiscale is babase.UIScale.SMALL else
|
||||||
108 if _uiscale is babase.UIScale.MEDIUM else 120)
|
108 if _uiscale is babase.UIScale.MEDIUM else 120)
|
||||||
|
|
||||||
controller_button = bui.buttonwidget(parent=self._root_widget,
|
controller_button = bui.buttonwidget(
|
||||||
|
parent=self._root_widget,
|
||||||
position=(refresh_pos_x, refresh_pos_y),
|
position=(refresh_pos_x, refresh_pos_y),
|
||||||
size=(30, 30),
|
size=(30, 30),
|
||||||
button_type="square",
|
button_type="square",
|
||||||
label="",
|
label="",
|
||||||
on_activate_call=lambda:
|
on_activate_call=lambda: loop.create_task(self.refresh())
|
||||||
loop.create_task(self.refresh()))
|
)
|
||||||
bui.imagewidget(parent=self._root_widget,
|
bui.imagewidget(
|
||||||
|
parent=self._root_widget,
|
||||||
position=(refresh_pos_x, refresh_pos_y),
|
position=(refresh_pos_x, refresh_pos_y),
|
||||||
size=(30, 30),
|
size=(30, 30),
|
||||||
color=(0.8, 0.95, 1),
|
color=(0.8, 0.95, 1),
|
||||||
texture=bui.gettexture("replayIcon"),
|
texture=bui.gettexture("replayIcon"),
|
||||||
draw_controller=controller_button)
|
draw_controller=controller_button
|
||||||
|
)
|
||||||
|
|
||||||
def search_term_filterer(self, plugin, search_term):
|
def search_term_filterer(self, plugin, search_term):
|
||||||
# This helps resolve "plugin name" to "plugin_name".
|
# This helps resolve "plugin name" to "plugin_name".
|
||||||
|
|
@ -2033,17 +2046,18 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
self._last_filter_text = search_term
|
self._last_filter_text = search_term
|
||||||
self._last_filter_plugins = plugins
|
self._last_filter_plugins = plugins
|
||||||
|
|
||||||
|
if not self._columnwidget.exists(): return
|
||||||
|
|
||||||
if category == 'Installed':
|
if category == 'Installed':
|
||||||
plugin_names_to_draw = tuple(self.draw_plugin_name(plugin)
|
plugin_names_to_draw = tuple(
|
||||||
for plugin in plugins if plugin.is_installed)
|
self.draw_plugin_name(plugin) for plugin in plugins if plugin.is_installed
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
plugin_names_to_draw = tuple(self.draw_plugin_name(plugin) for plugin in plugins)
|
plugin_names_to_draw = tuple(self.draw_plugin_name(plugin) for plugin in plugins)
|
||||||
|
|
||||||
for plugin in self._columnwidget.get_children():
|
[plugin.delete() for plugin in self._columnwidget.get_children()]
|
||||||
plugin.delete()
|
|
||||||
text_widget = bui.textwidget(parent=self._columnwidget)
|
text_widget = bui.textwidget(parent=self._columnwidget)
|
||||||
text_widget.delete()
|
text_widget.delete()
|
||||||
|
|
||||||
await asyncio.gather(*plugin_names_to_draw)
|
await asyncio.gather(*plugin_names_to_draw)
|
||||||
|
|
||||||
async def draw_plugin_name(self, plugin):
|
async def draw_plugin_name(self, plugin):
|
||||||
|
|
@ -2069,10 +2083,13 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
|
|
||||||
plugin_name_widget_to_update = self.plugins_in_current_view.get(plugin.name)
|
plugin_name_widget_to_update = self.plugins_in_current_view.get(plugin.name)
|
||||||
if plugin_name_widget_to_update:
|
if plugin_name_widget_to_update:
|
||||||
bui.textwidget(edit=plugin_name_widget_to_update,
|
bui.textwidget(
|
||||||
color=color)
|
edit=plugin_name_widget_to_update,
|
||||||
|
color=color
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
text_widget = bui.textwidget(parent=self._columnwidget,
|
text_widget = bui.textwidget(
|
||||||
|
parent=self._columnwidget,
|
||||||
size=(410, 30),
|
size=(410, 30),
|
||||||
selectable=True,
|
selectable=True,
|
||||||
always_highlight=True,
|
always_highlight=True,
|
||||||
|
|
@ -2082,7 +2099,8 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
on_activate_call=lambda: self.show_plugin_window(plugin),
|
on_activate_call=lambda: self.show_plugin_window(plugin),
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=420)
|
maxwidth=420
|
||||||
|
)
|
||||||
self.plugins_in_current_view[plugin.name] = text_widget
|
self.plugins_in_current_view[plugin.name] = text_widget
|
||||||
# XXX: This seems nicer. Might wanna use this in future.
|
# XXX: This seems nicer. Might wanna use this in future.
|
||||||
# text_widget.add_delete_callback(lambda: self.plugins_in_current_view.pop(plugin.name))
|
# text_widget.add_delete_callback(lambda: self.plugins_in_current_view.pop(plugin.name))
|
||||||
|
|
@ -2120,13 +2138,13 @@ class PluginManagerWindow(bui.MainWindow):
|
||||||
# except:
|
# except:
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
bui.spinnerwidget(edit=self._loading_spinner, visible=True)
|
self.spin(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()
|
||||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
self.spin()
|
||||||
try:
|
try:
|
||||||
bui.textwidget(edit=self._plugin_manager_status_text, text="")
|
bui.textwidget(edit=self._plugin_manager_status_text, text="")
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue