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
|
||||
import logging
|
||||
|
||||
PLUGIN_MANAGER_VERSION = "1.1.2"
|
||||
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.
|
||||
|
|
@ -1760,12 +1760,17 @@ class PluginManagerWindow(bui.MainWindow):
|
|||
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
|
||||
def exception_handler(self):
|
||||
try:
|
||||
yield
|
||||
except urllib.error.URLError:
|
||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
||||
self.spin()
|
||||
try:
|
||||
bui.textwidget(
|
||||
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.
|
||||
pass
|
||||
except Exception as e:
|
||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
||||
self.spin()
|
||||
try:
|
||||
bui.textwidget(edit=self._plugin_manager_status_text, text=str(e))
|
||||
except:
|
||||
|
|
@ -1794,7 +1799,7 @@ class PluginManagerWindow(bui.MainWindow):
|
|||
with self.exception_handler():
|
||||
await self.plugin_manager.setup_changelog()
|
||||
await self.plugin_manager.setup_index()
|
||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
||||
self.spin()
|
||||
try:
|
||||
bui.textwidget(edit=self._plugin_manager_status_text, text="")
|
||||
except:
|
||||
|
|
@ -1840,9 +1845,11 @@ class PluginManagerWindow(bui.MainWindow):
|
|||
textcolor=b_textcolor,
|
||||
text_scale=0.6)
|
||||
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')
|
||||
)
|
||||
) if b.exists() else None
|
||||
|
||||
label = f"Category: {post_label}"
|
||||
|
||||
|
|
@ -1857,8 +1864,11 @@ class PluginManagerWindow(bui.MainWindow):
|
|||
text_scale=0.6)
|
||||
bui.buttonwidget(b,on_activate_call=lambda: self.show_categories_window(source=b)),
|
||||
else:
|
||||
self.category_selection_button = bui.buttonwidget(edit=self.category_selection_button,
|
||||
label=label)
|
||||
b = self.category_selection_button
|
||||
bui.buttonwidget(
|
||||
edit=b,
|
||||
label=label
|
||||
) if b.exists() else 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')
|
||||
|
|
@ -1965,19 +1975,22 @@ class PluginManagerWindow(bui.MainWindow):
|
|||
refresh_pos_y = (180 if _uiscale is babase.UIScale.SMALL else
|
||||
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),
|
||||
size=(30, 30),
|
||||
button_type="square",
|
||||
label="",
|
||||
on_activate_call=lambda:
|
||||
loop.create_task(self.refresh()))
|
||||
bui.imagewidget(parent=self._root_widget,
|
||||
on_activate_call=lambda: loop.create_task(self.refresh())
|
||||
)
|
||||
bui.imagewidget(
|
||||
parent=self._root_widget,
|
||||
position=(refresh_pos_x, refresh_pos_y),
|
||||
size=(30, 30),
|
||||
color=(0.8, 0.95, 1),
|
||||
texture=bui.gettexture("replayIcon"),
|
||||
draw_controller=controller_button)
|
||||
draw_controller=controller_button
|
||||
)
|
||||
|
||||
def search_term_filterer(self, plugin, search_term):
|
||||
# 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_plugins = plugins
|
||||
|
||||
if not self._columnwidget.exists(): return
|
||||
|
||||
if category == 'Installed':
|
||||
plugin_names_to_draw = tuple(self.draw_plugin_name(plugin)
|
||||
for plugin in plugins if plugin.is_installed)
|
||||
plugin_names_to_draw = tuple(
|
||||
self.draw_plugin_name(plugin) for plugin in plugins if plugin.is_installed
|
||||
)
|
||||
else:
|
||||
plugin_names_to_draw = tuple(self.draw_plugin_name(plugin) for plugin in plugins)
|
||||
|
||||
for plugin in self._columnwidget.get_children():
|
||||
plugin.delete()
|
||||
[plugin.delete() for plugin in self._columnwidget.get_children()]
|
||||
text_widget = bui.textwidget(parent=self._columnwidget)
|
||||
text_widget.delete()
|
||||
|
||||
await asyncio.gather(*plugin_names_to_draw)
|
||||
|
||||
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)
|
||||
if plugin_name_widget_to_update:
|
||||
bui.textwidget(edit=plugin_name_widget_to_update,
|
||||
color=color)
|
||||
bui.textwidget(
|
||||
edit=plugin_name_widget_to_update,
|
||||
color=color
|
||||
)
|
||||
else:
|
||||
text_widget = bui.textwidget(parent=self._columnwidget,
|
||||
text_widget = bui.textwidget(
|
||||
parent=self._columnwidget,
|
||||
size=(410, 30),
|
||||
selectable=True,
|
||||
always_highlight=True,
|
||||
|
|
@ -2082,7 +2099,8 @@ class PluginManagerWindow(bui.MainWindow):
|
|||
on_activate_call=lambda: self.show_plugin_window(plugin),
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
maxwidth=420)
|
||||
maxwidth=420
|
||||
)
|
||||
self.plugins_in_current_view[plugin.name] = text_widget
|
||||
# XXX: This seems nicer. Might wanna use this in future.
|
||||
# text_widget.add_delete_callback(lambda: self.plugins_in_current_view.pop(plugin.name))
|
||||
|
|
@ -2120,13 +2138,13 @@ class PluginManagerWindow(bui.MainWindow):
|
|||
# except:
|
||||
# pass
|
||||
|
||||
bui.spinnerwidget(edit=self._loading_spinner, visible=True)
|
||||
self.spin(True)
|
||||
|
||||
with self.exception_handler():
|
||||
await self.plugin_manager.refresh()
|
||||
await self.plugin_manager.setup_changelog()
|
||||
await self.plugin_manager.setup_index()
|
||||
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
|
||||
self.spin()
|
||||
try:
|
||||
bui.textwidget(edit=self._plugin_manager_status_text, text="")
|
||||
except:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue