um small change (version bump can be done in the end)

This commit is contained in:
Vishal 2025-01-21 20:33:50 +05:30 committed by GitHub
parent f13cdafffc
commit ccf78e7ad0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,13 +23,13 @@ import pathlib
import hashlib import hashlib
import contextlib import contextlib
from typing import cast
from datetime import datetime from datetime import datetime
from typing import cast, override
# Modules used for overriding AllSettingsWindow # Modules used for overriding AllSettingsWindow
import logging import logging
PLUGIN_MANAGER_VERSION = "1.1.0" PLUGIN_MANAGER_VERSION = "1.0.23"
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.
@ -37,6 +37,7 @@ CURRENT_TAG = "main"
_env = _babase.env() _env = _babase.env()
_uiscale = bui.app.ui_v1.uiscale _uiscale = bui.app.ui_v1.uiscale
_app_api_version = babase.app.env.api_version
INDEX_META = "{repository_url}/{content_type}/{tag}/index.json" INDEX_META = "{repository_url}/{content_type}/{tag}/index.json"
CHANGELOG_META = "{repository_url}/{content_type}/{tag}/CHANGELOG.md" CHANGELOG_META = "{repository_url}/{content_type}/{tag}/CHANGELOG.md"
@ -786,7 +787,7 @@ class Plugin:
def latest_compatible_version(self): def latest_compatible_version(self):
if self._latest_compatible_version is None: if self._latest_compatible_version is None:
for number, info in self.info["versions"].items(): for number, info in self.info["versions"].items():
if info["api_version"] == babase.app.env.api_version: if info["api_version"] == _app_api_version:
self._latest_compatible_version = PluginVersion( self._latest_compatible_version = PluginVersion(
self, self,
(number, info), (number, info),
@ -795,7 +796,7 @@ class Plugin:
break break
if self._latest_compatible_version is None: if self._latest_compatible_version is None:
raise NoCompatibleVersion( raise NoCompatibleVersion(
f"{self.name} has no version compatible with API {babase.app.env.api_version}." f"{self.name} has no version compatible with API {_app_api_version}."
) )
return self._latest_compatible_version return self._latest_compatible_version
@ -1427,7 +1428,7 @@ class PluginManager:
async def get_update_details(self): async def get_update_details(self):
index = await self.get_index() index = await self.get_index()
for version, info in index["versions"].items(): for version, info in index["versions"].items():
if info["api_version"] != babase.app.env.api_version: if info["api_version"] != _app_api_version:
# No point checking a version of the API game doesn't support. # No point checking a version of the API game doesn't support.
continue continue
if version == PLUGIN_MANAGER_VERSION: if version == PLUGIN_MANAGER_VERSION:
@ -1765,8 +1766,7 @@ class PluginManagerWindow(bui.MainWindow):
edit=self._plugin_manager_status_text, edit=self._plugin_manager_status_text,
text="Make sure you are connected\n to the Internet and try again." text="Make sure you are connected\n to the Internet and try again."
) )
except: except: pass
pass
self.plugin_manager._index_setup_in_progress = False self.plugin_manager._index_setup_in_progress = False
except RuntimeError: except RuntimeError:
# User probably went back before a bui.Window could finish loading. # User probably went back before a bui.Window could finish loading.
@ -1775,8 +1775,7 @@ class PluginManagerWindow(bui.MainWindow):
self._dot_timer = None self._dot_timer = None
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): def _update_dots(self):
@ -1785,8 +1784,7 @@ class PluginManagerWindow(bui.MainWindow):
if text.endswith('....'): if text.endswith('....'):
text = text[0:len(text)-4] text = text[0:len(text)-4]
bui.textwidget(edit=self._plugin_manager_status_text, text=(text + '.')) bui.textwidget(edit=self._plugin_manager_status_text, text=(text + '.'))
except: except: pass
pass
async def draw_index(self): async def draw_index(self):
self.draw_search_bar() self.draw_search_bar()
@ -1800,8 +1798,7 @@ class PluginManagerWindow(bui.MainWindow):
self._dot_timer = None self._dot_timer = None
try: try:
bui.textwidget(edit=self._plugin_manager_status_text, text="") bui.textwidget(edit=self._plugin_manager_status_text, text="")
except: except: pass
pass
await self.select_category("All") await self.select_category("All")
def draw_plugins_scroll_bar(self): def draw_plugins_scroll_bar(self):
@ -2116,8 +2113,7 @@ class PluginManagerWindow(bui.MainWindow):
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: if self._dot_timer is None:
self._dot_timer = babase.AppTimer(0.5, self._update_dots, repeat=True) self._dot_timer = babase.AppTimer(0.5, self._update_dots, repeat=True)
@ -2128,8 +2124,7 @@ class PluginManagerWindow(bui.MainWindow):
self._dot_timer = None self._dot_timer = None
try: try:
bui.textwidget(edit=self._plugin_manager_status_text, text="") bui.textwidget(edit=self._plugin_manager_status_text, text="")
except: except: pass
pass
await self.select_category(self.selected_category) await self.select_category(self.selected_category)
def soft_refresh(self): def soft_refresh(self):
@ -2327,7 +2322,7 @@ class PluginManagerSettingsWindow(popup.PopupWindow):
size=(0, 0), size=(0, 0),
h_align='center', h_align='center',
v_align='center', v_align='center',
text=f'API Version: {babase.app.env.api_version}', text=f'API Version: {_app_api_version}',
scale=text_scale * 0.7, scale=text_scale * 0.7,
color=(0.4, 0.8, 1), color=(0.4, 0.8, 1),
maxwidth=width * 0.95) maxwidth=width * 0.95)