diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2816e52..24c639d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.12"] steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 429aa3a..9cfbbd7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: 'Get Previous tag' uses: oprypin/find-latest-tag@v1.1.2 @@ -27,14 +27,16 @@ jobs: - name: set_variables run: | - output1=$(python3 test/get_latest.py) + output1=$(python3 test/get_latest.py get_latest_version) { echo "changelog<> "$GITHUB_OUTPUT" + output2=$(python3 test/get_latest.py get_latest_api) output3=$(python3 test/version_is_lower.py ${{ steps.previoustag.outputs.tag }}) echo "latestVersion=$output1" >> $GITHUB_OUTPUT + echo "latestAPI=$output2" >> $GITHUB_OUTPUT echo "shouldRun=$output3" >> $GITHUB_OUTPUT id: set_variables @@ -54,7 +56,7 @@ jobs: uses: ncipollo/release-action@v1 with: tag: ${{ steps.tag_version.outputs.new_tag }} - name: Release ${{ steps.tag_version.outputs.new_tag }} + name: ${{ steps.tag_version.outputs.new_tag }} (api ${{ steps.set_variables.outputs.latestAPI }}) artifacts: "plugin_manager.py" body: | ## Changelog diff --git a/CHANGELOG.md b/CHANGELOG.md index 54ef953..880f215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Plugin Manager (dd-mm-yyyy) +### 1.1.0 (23-01-2025) + +- Updated to bombsquad api 9. + ### 1.0.23 (13-01-2025) - Fixed a bug which wasn't letting older versions run Plugin Manager. diff --git a/README.md b/README.md index fc5b3ae..5a46f75 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ [![CI](https://github.com/bombsquad-community/plugin-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/bombsquad-community/plugin-manager/actions/workflows/ci.yml) -**Important:** Please check out the [api7](https://github.com/bombsquad-community/plugin-manager/tree/api7) branch if you're -using the game version (1.7.0 <= your game version <= 1.7.19) which uses API 7 plugins. -If you're on game version (1.7.20 or a later version) where it uses API 8 plugins, then proceed with the rest of the -README here. +**Important:** If you are on bombsquad version less than 1.7.37 , check below. +- for version 1.7.0 to 1.7.19 (which uses API 7), checkout the [api7](https://github.com/bombsquad-community/plugin-manager/tree/api7) branch. +- for version 1.7.20 to 1.7.36 (which uses API 8), checkout the [api8](https://github.com/bombsquad-community/plugin-manager/tree/api8) branch. + +If you have version 1.7.37 or greater (which uses API 9), proceed with the rest of the README here. ------------------------------- -# Plugin-Manager +# Plugin Manager -A plugin manager for the game - [Bombsquad](https://www.froemling.net/apps/bombsquad). Plugin manager is a plugin in itself, +A plugin manager for the game - [Bombsquad](https://www.froemling.net/apps/bombsquad). Plugin Manager is a plugin in itself, which makes further modding of your game more convenient by providing easier access to community created content. [![DownloadIcon]][DownloadLink] @@ -90,7 +91,7 @@ There are two different ways the plugin manager can be installed: Let's say you wanna submit this new utility-type plugin named as `sample_plugin.py`: ```python -# ba_meta require api 8 +# ba_meta require api 9 import babase # ba_meta export babase.Plugin @@ -242,5 +243,5 @@ create something similar, with a hope we as a community can continue to keep it information. - Any plugins you submit here are automatically assumed to be licensed under the MIT license, i.e. unless you explicitly specify a different license in your plugin's source code. See - [this plugin](https://github.com/rikkolovescats/plugin-manager/blob/f29008acdbf54988f3622ae4baa8735d83338bb5/plugins/utilities/store_event_specials.py#L1-L22) + [this plugin](https://github.com/bombsquad-community/plugin-manager/blob/cba1194c68ce550a71d2f3fadd9e1b8cbac4981c/plugins/utilities/store_event_specials.py#L1-L22) for an example. diff --git a/index.json b/index.json index 5a20bca..ee77c83 100644 --- a/index.json +++ b/index.json @@ -1,6 +1,12 @@ { "plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py", "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "4b39a24", + "released_on": "23-01-2025", + "md5sum": "d58551313ae91498c0b0ba804df1066e" + }, "1.0.23": { "api_version": 8, "commit_sha": "1d6a41f", diff --git a/plugin_manager.py b/plugin_manager.py index c39888c..17ecb74 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -1,79 +1,43 @@ -# ba_meta require api 8 -from babase._meta import EXPORT_CLASS_NAME_SHORTCUTS -from baenv import TARGET_BALLISTICA_BUILD +# ba_meta require api 9 import babase import _babase -import bauiv1 as bui import _bauiv1 import _bascenev1 +import bauiv1 as bui from bauiv1lib import popup, confirm +from babase._meta import EXPORT_CLASS_NAME_SHORTCUTS +from bauiv1lib.settings.allsettings import AllSettingsWindow import urllib.request import http.client import socket -import ssl import json +import ssl +import re import os import sys -import asyncio -import re -import pathlib -import contextlib -import hashlib import copy -import traceback +import asyncio +import pathlib +import hashlib +import contextlib -from typing import Union, Optional, cast +from typing import cast from datetime import datetime # Modules used for overriding AllSettingsWindow -from threading import Thread import logging -PLUGIN_MANAGER_VERSION = "1.0.23" +PLUGIN_MANAGER_VERSION = "1.1.0" 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. CURRENT_TAG = "main" - -if TARGET_BALLISTICA_BUILD < 21282: - # These attributes have been deprecated as of 1.7.27. For more info see: - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1727-build-21282-api-8-2023-08-30 - # Adding a compatibility layer here so older builds still work fine. - class Dummy: - build_number = babase.app.build_number - device_name = babase.app.device_name - config_file_path = babase.app.config_file_path - version = babase.app.version - debug = babase.app.debug_build - test = babase.app.test_build - data_directory = babase.app.data_directory - python_directory_user = babase.app.python_directory_user - python_directory_app = babase.app.python_directory_app - python_directory_app_site = babase.app.python_directory_app_site - api_version = babase.app.api_version - tv = babase.app.on_tv - vr = babase.app.vr_mode - arcade = babase.app.arcade_mode - headless = babase.app.arcade_mode - demo = babase.app.demo_mode - - _bascenev1.protocol_version = lambda: babase.app.protocol_version - _bauiv1.toolbar_test = lambda: babase.app.toolbar_test - - babase.app.env = Dummy - -if TARGET_BALLISTICA_BUILD < 21852: - class Dummy(babase.app.env): - engine_build_number = babase.app.env.build_number - engine_version = babase.app.env.version - - babase.app.env = Dummy - _env = _babase.env() _uiscale = bui.app.ui_v1.uiscale +_app_api_version = babase.app.env.api_version INDEX_META = "{repository_url}/{content_type}/{tag}/index.json" CHANGELOG_META = "{repository_url}/{content_type}/{tag}/CHANGELOG.md" @@ -654,21 +618,8 @@ class PluginLocal: for entry_point, plugin_info in babase.app.config["Plugins"].items(): if entry_point.startswith(self._entry_point_initials) and plugin_info["enabled"]: return True - # XXX: The below logic is more accurate but less efficient, since it actually - # reads the local plugin file and parses entry points from it. - # for entry_point in await self.get_entry_points(): - # if babase.app.config["Plugins"][entry_point]["enabled"]: - # return True return False - # XXX: Commenting this out for now, since `enable` and `disable` currently have their - # own separate logic. - # async def _set_status(self, to_enable=True): - # for entry_point in await self.get_entry_points: - # if entry_point not in babase.app.config["Plugins"]: - # babase.app.config["Plugins"][entry_point] = {} - # babase.app.config["Plugins"][entry_point]["enabled"] = to_enable - async def enable(self): for entry_point in await self.get_entry_points(): if entry_point not in babase.app.config["Plugins"]: @@ -680,7 +631,6 @@ class PluginLocal: bui.screenmessage(f"{entry_point} loaded") if await self.has_minigames(): self.load_minigames() - # await self._set_status(to_enable=True) self.save() def load_plugin(self, entry_point): @@ -697,11 +647,7 @@ class PluginLocal: def disable(self): for entry_point, plugin_info in babase.app.config["Plugins"].items(): if entry_point.startswith(self._entry_point_initials): - # if plugin_info["enabled"]: plugin_info["enabled"] = False - # XXX: The below logic is more accurate but less efficient, since it actually - # reads the local plugin file and parses entry points from it. - # await self._set_status(to_enable=False) self.save() def set_version(self, version): @@ -709,15 +655,6 @@ class PluginLocal: app.config["Community Plugin Manager"]["Installed Plugins"][self.name]["version"] = version return self - # def set_entry_points(self): - # if not "entry_points" in babase.app.config["Community Plugin Manager"] - # ["Installed Plugins"][self.name]: - # babase.app.config["Community Plugin Manager"]["Installed Plugins"] - # [self.name]["entry_points"] = [] - # for entry_point in await self.get_entry_points(): - # babase.app.config["Community Plugin Manager"]["Installed Plugins"][self.name] - # ["entry_points"].append(entry_point) - async def set_content(self, content): if not self._content: @@ -850,7 +787,7 @@ class Plugin: def latest_compatible_version(self): if self._latest_compatible_version is None: 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, (number, info), @@ -859,7 +796,7 @@ class Plugin: break if self._latest_compatible_version is None: 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 @@ -932,7 +869,6 @@ class ChangelogWindow(popup.PopupWindow): size=(60, 60), scale=0.8, label=babase.charstr(babase.SpecialChar.BACK), - # autoselect=True, button_type='backSmall', on_activate_call=self._back) @@ -1012,7 +948,6 @@ class AuthorsWindow(popup.PopupWindow): size=(60, 60), scale=0.8, label=babase.charstr(babase.SpecialChar.BACK), - # autoselect=True, button_type='backSmall', on_activate_call=self._back) @@ -1096,8 +1031,6 @@ class PluginWindow(popup.PopupWindow): transition = 'in_scale' self._root_widget = bui.containerwidget(size=(width, height), - # parent=_babase.get_special_widget( - # 'overlay_stack'), on_outside_click_call=self._cancel, transition=transition, scale=(2.1 if _uiscale is babase.UIScale.SMALL else 1.5 @@ -1134,14 +1067,8 @@ class PluginWindow(popup.PopupWindow): maxwidth=width * 0.9, draw_controller=author_text_control_btn, ) - pos -= 35 - # status = bui.textwidget(parent=self._root_widget, - # position=(width * 0.49, pos), size=(0, 0), - # h_align='center', v_align='center', - # text=status_text, scale=text_scale * 0.8, - # color=color, maxwidth=width * 0.9) - pos -= 25 - # info = + pos -= 60 + # Info bui.textwidget(parent=self._root_widget, position=(width * 0.49, pos), size=(0, 0), h_align='center', v_align='center', @@ -1233,7 +1160,6 @@ class PluginWindow(popup.PopupWindow): size=(40, 40), button_type="square", label="", - # color=bui.app.ui_v1.title_color, color=(0.6, 0.53, 0.63), on_activate_call=lambda: bui.open_url(self.plugin.view_url)) bui.imagewidget(parent=self._root_widget, @@ -1270,7 +1196,6 @@ class PluginWindow(popup.PopupWindow): size=(40, 40), button_type="square", label="", - # color=bui.app.ui_v1.title_color, color=(0.6, 0.53, 0.63), on_activate_call=tutorial_confirm_window) @@ -1312,9 +1237,6 @@ class PluginWindow(popup.PopupWindow): texture=bui.gettexture("settingsIcon"), draw_controller=settings_button) - # bui.containerwidget(edit=self._root_widget, selected_child=button3) - # bui.containerwidget(edit=self._root_widget, start_button=button3) - def _ok(self) -> None: bui.containerwidget(edit=self._root_widget, transition='out_scale') @@ -1506,7 +1428,7 @@ class PluginManager: async def get_update_details(self): index = await self.get_index() 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. continue if version == PLUGIN_MANAGER_VERSION: @@ -1550,13 +1472,9 @@ class PluginSourcesWindow(popup.PopupWindow): self.scale_origin = origin_widget.get_screen_space_center() b_textcolor = (0.75, 0.7, 0.8) - # s = 1.1 if _uiscale is babase.UIScale.SMALL else 1.27 if babase.UIScale.MEDIUM else 1.57 - # text_scale = 0.7 * s self._transition_out = 'out_scale' transition = 'in_scale' self._root_widget = bui.containerwidget(size=(400, 340), - # parent=_babase.get_special_widget( - # 'overlay_stack'), on_outside_click_call=self._ok, transition=transition, scale=(2.1 if _uiscale is babase.UIScale.SMALL else 1.5 @@ -1596,21 +1514,15 @@ class PluginSourcesWindow(popup.PopupWindow): delete_source_button = bui.buttonwidget(parent=self._root_widget, position=(delete_source_button_position_pos_x, delete_source_button_position_pos_y), - size=(25, 25), + size=(25, 25), label="", on_activate_call=self.delete_selected_source, - label="", - # texture=bui.gettexture("crossOut"), button_type="square", - color=(0.6, 0, 0), - textcolor=b_textcolor, - # autoselect=True, - text_scale=1) + color=(0.6, 0, 0)) bui.imagewidget(parent=self._root_widget, position=(delete_source_button_position_pos_x + 2, delete_source_button_position_pos_y), - size=(25, 25), - color=(5, 2, 2), + size=(25, 25), color=(5, 2, 2), texture=bui.gettexture("crossOut"), draw_controller=delete_source_button) @@ -1631,7 +1543,6 @@ class PluginSourcesWindow(popup.PopupWindow): ) self._add_source_widget = bui.textwidget(parent=self._root_widget, - # text="rikkolovescats/sahilp-plugins", size=(335, 50), position=(21, 22), h_align='left', @@ -1639,7 +1550,6 @@ class PluginSourcesWindow(popup.PopupWindow): editable=True, scale=0.75, maxwidth=215, - # autoselect=True, description="Add Source") bui.buttonwidget(parent=self._root_widget, @@ -1648,11 +1558,9 @@ class PluginSourcesWindow(popup.PopupWindow): on_activate_call=lambda: loop.create_task(self.add_source()), label="", texture=bui.gettexture("startButton"), - # texture=bui.gettexture("chestOpenIcon"), button_type="square", color=(0, 0.9, 0), textcolor=b_textcolor, - # autoselect=True, text_scale=1) self.draw_sources() @@ -1664,12 +1572,9 @@ class PluginSourcesWindow(popup.PopupWindow): color = (1, 1, 1) for custom_source in babase.app.config["Community Plugin Manager"]["Custom Sources"]: bui.textwidget(parent=self._columnwidget, - # size=(410, 30), selectable=True, - # always_highlight=True, color=color, text=custom_source, - # click_activate=True, on_select_call=lambda: self.select_source(custom_source), h_align='left', v_align='center', @@ -1761,7 +1666,7 @@ class PluginCategoryWindow(popup.PopupMenuWindow): bui.containerwidget(edit=self.root_widget, transition='out_scale') -class PluginManagerWindow(bui.Window): +class PluginManagerWindow(bui.MainWindow): def __init__(self, transition: str = "in_right", origin_widget: bui.Widget = None): self.plugin_manager = PluginManager() self.category_selection_button = None @@ -1785,32 +1690,40 @@ class PluginManagerWindow(bui.Window): self._scale_origin = origin_widget.get_screen_space_center() transition = "in_scale" - super().__init__(root_widget=bui.containerwidget( - size=(self._width, self._height + top_extra), + super().__init__( + root_widget=bui.containerwidget( + size=(self._width, self._height + top_extra), + toolbar_visibility="menu_minimal", + scale=(1.9 if _uiscale is babase.UIScale.SMALL + else 1.5 if _uiscale is babase.UIScale.MEDIUM + else 1.0), + stack_offset=(0, -25) if _uiscale is babase.UIScale.SMALL else (0, 0) + ), transition=transition, - toolbar_visibility="menu_minimal", - scale_origin_stack_offset=self._scale_origin, - scale=(1.9 if _uiscale is babase.UIScale.SMALL - else 1.5 if _uiscale is babase.UIScale.MEDIUM - else 1.0), - stack_offset=(0, -25) if _uiscale is babase.UIScale.SMALL else (0, 0) - )) + origin_widget=origin_widget, + ) back_pos_x = 5 + (37 if _uiscale is babase.UIScale.SMALL else 27 if _uiscale is babase.UIScale.MEDIUM else 68) back_pos_y = self._height - (95 if _uiscale is babase.UIScale.SMALL else 65 if _uiscale is babase.UIScale.MEDIUM else 50) - self._back_button = back_button = bui.buttonwidget( - parent=self._root_widget, - position=(back_pos_x, back_pos_y), - size=(60, 60), - scale=0.8, - label=babase.charstr(babase.SpecialChar.BACK), - # autoselect=True, - button_type='backSmall', - on_activate_call=self._back) - bui.containerwidget(edit=self._root_widget, cancel_button=back_button) + if _uiscale is bui.UIScale.SMALL: + self._back_button = None + bui.containerwidget( + edit=self._root_widget, on_cancel_call=self.main_window_back + ) + else: + self._back_button = back_button = bui.buttonwidget( + parent=self._root_widget, + position=(back_pos_x, back_pos_y), + size=(60, 60), + scale=0.8, + label=babase.charstr(babase.SpecialChar.BACK), + button_type='backSmall', + on_activate_call=self.main_window_back) + + bui.containerwidget(edit=self._root_widget, cancel_button=back_button) title_pos = self._height - (83 if _uiscale is babase.UIScale.SMALL else 50 if _uiscale is babase.UIScale.MEDIUM else 50) @@ -1842,47 +1755,39 @@ class PluginManagerWindow(bui.Window): ) self._dot_timer = babase.AppTimer(0.5, self._update_dots, repeat=True) - def _back(self) -> None: - from bauiv1lib.settings.allsettings import AllSettingsWindow - del self._last_filter_plugins - bui.containerwidget(edit=self._root_widget, - transition=self._transition_out) - if TARGET_BALLISTICA_BUILD < 21697: - # from_window parameter was added in 1.7.30, see changelogs below - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1730-build-21697-api-8-2023-12-08 - # Adding a check here so older builds still work fine. - bui.app.ui_v1.set_main_menu_window( - AllSettingsWindow(transition='in_left').get_root_widget()) - else: - bui.app.ui_v1.set_main_menu_window( - AllSettingsWindow(transition='in_left').get_root_widget(), - from_window=self._root_widget,) - @contextlib.contextmanager def exception_handler(self): try: yield except urllib.error.URLError: self._dot_timer = None - bui.textwidget(edit=self._plugin_manager_status_text, - text="Make sure you are connected\n to the Internet and try again.") + try: + bui.textwidget( + edit=self._plugin_manager_status_text, + text="Make sure you are connected\n to the Internet and try again." + ) + except: + pass self.plugin_manager._index_setup_in_progress = False except RuntimeError: # User probably went back before a bui.Window could finish loading. pass except Exception as e: self._dot_timer = None - bui.textwidget(edit=self._plugin_manager_status_text, - text=str(e)) + try: + bui.textwidget(edit=self._plugin_manager_status_text, text=str(e)) + except: + pass raise def _update_dots(self): - text = cast(str, bui.textwidget(query=self._plugin_manager_status_text)) - if text.endswith('....'): - text = text[0:len(text)-4] - text = text + '.' - bui.textwidget(edit=self._plugin_manager_status_text, - text=text) + 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() @@ -1894,8 +1799,10 @@ class PluginManagerWindow(bui.Window): await self.plugin_manager.setup_changelog() await self.plugin_manager.setup_index() self._dot_timer = None - bui.textwidget(edit=self._plugin_manager_status_text, - text="") + try: + bui.textwidget(edit=self._plugin_manager_status_text, text="") + except: + pass await self.select_category("All") def draw_plugins_scroll_bar(self): @@ -1920,9 +1827,7 @@ class PluginManagerWindow(bui.Window): category_pos_y = self._height - (141 if _uiscale is babase.UIScale.SMALL else 110 if _uiscale is babase.UIScale.MEDIUM else 110) b_size = (140, 30) - # b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.8, 0.8, 0.85) - # b_color = (0.6, 0.53, 0.63) if self.alphabet_order_selection_button is None: self.alphabet_order_selection_button = bui.buttonwidget(parent=self._root_widget, @@ -1954,9 +1859,7 @@ class PluginManagerWindow(bui.Window): self.show_categories_window), label=label, button_type="square", - # color=b_color, textcolor=b_textcolor, - # autoselect=True, text_scale=0.6) else: self.category_selection_button = bui.buttonwidget(edit=self.category_selection_button, @@ -2035,21 +1938,6 @@ class PluginManagerWindow(bui.Window): self.selected_category, search_term=filter_text.lower(), order=self.selected_alphabet_order) except CategoryDoesNotExist: pass - # XXX: This may be more efficient, but we need a way to get a plugin's textwidget - # attributes like color, position and more. - # for plugin in self._columnwidget.get_children(): - # for name, widget in tuple(self.plugins_in_current_view.items()): - # # print(bui.textwidget(query=plugin)) - # # plugin.delete() - # print(dir(widget)) - # if filter_text in name: - # import random - # if random.random() > 0.9: - # bui.textwidget(edit=widget).delete() - # else: - # bui.textwidget(edit=widget, position=None) - # else: - # bui.textwidget(edit=widget, position=None) def draw_settings_icon(self): settings_pos_x = (610 if _uiscale is babase.UIScale.SMALL else @@ -2057,7 +1945,6 @@ class PluginManagerWindow(bui.Window): settings_pos_y = (130 if _uiscale is babase.UIScale.SMALL else 60 if _uiscale is babase.UIScale.MEDIUM else 70) controller_button = bui.buttonwidget(parent=self._root_widget, - # autoselect=True, position=(settings_pos_x, settings_pos_y), size=(30, 30), button_type="square", @@ -2079,7 +1966,6 @@ class PluginManagerWindow(bui.Window): 108 if _uiscale is babase.UIScale.MEDIUM else 120) controller_button = bui.buttonwidget(parent=self._root_widget, - # autoselect=True, position=(refresh_pos_x, refresh_pos_y), size=(30, 30), button_type="square", @@ -2095,24 +1981,16 @@ class PluginManagerWindow(bui.Window): def search_term_filterer(self, plugin, search_term): # This helps resolve "plugin name" to "plugin_name". + if search_term in plugin.info["description"].lower(): + return True search_term = search_term.replace(" ", "_") if search_term in plugin.name: return True - if search_term in plugin.info["description"].lower(): - return True for author in plugin.info["authors"]: if search_term in author["name"].lower(): return True return False - # async def draw_plugin_names(self, category): - # for plugin in self._columnwidget.get_children(): - # plugin.delete() - - # plugins = await self.plugin_manager.categories[category].get_plugins() - # plugin_names_to_draw = tuple(self.draw_plugin_name(plugin) for plugin in plugins) - # await asyncio.gather(*plugin_names_to_draw) - # XXX: Not sure if this is the best way to handle search filters. async def draw_plugin_names(self, category, search_term="", refresh=False, order='a_z'): # Re-draw plugin list UI if either search term or category was switched. @@ -2199,7 +2077,6 @@ class PluginManagerWindow(bui.Window): selectable=True, always_highlight=True, color=color, - # on_select_call=lambda: None, text=plugin.name.replace('_', ' ').title(), click_activate=True, on_activate_call=lambda: self.show_plugin_window(plugin), @@ -2238,8 +2115,10 @@ class PluginManagerWindow(bui.Window): async def refresh(self): self.cleanup() - bui.textwidget(edit=self._plugin_manager_status_text, - text="Refreshing") + 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) @@ -2248,8 +2127,10 @@ class PluginManagerWindow(bui.Window): await self.plugin_manager.setup_changelog() await self.plugin_manager.setup_index() self._dot_timer = None - bui.textwidget(edit=self._plugin_manager_status_text, - text="") + try: + bui.textwidget(edit=self._plugin_manager_status_text, text="") + except: + pass await self.select_category(self.selected_category) def soft_refresh(self): @@ -2282,8 +2163,6 @@ class PluginManagerSettingsWindow(popup.PopupWindow): button_size = (32 * s, 32 * s) # index = await self._plugin_manager.get_index() self._root_widget = bui.containerwidget(size=(width, height), - # parent=_babase.get_special_widget( - # 'overlay_stack'), on_outside_click_call=self._ok, transition=transition, scale=(2.1 if _uiscale is babase.UIScale.SMALL else 1.5 @@ -2397,8 +2276,7 @@ class PluginManagerSettingsWindow(popup.PopupWindow): color=(1, 1, 1), draw_controller=self.github_button) - bui.containerwidget(edit=self._root_widget, - on_cancel_call=self._ok) + bui.containerwidget(edit=self._root_widget, on_cancel_call=self._ok) try: plugin_manager_update_available = await self._plugin_manager.get_update_details() @@ -2406,7 +2284,6 @@ class PluginManagerSettingsWindow(popup.PopupWindow): plugin_manager_update_available = False if plugin_manager_update_available: text_color = (0.75, 0.2, 0.2) - button_size = (95 * s, 32 * s) update_button_label = f'Update to v{plugin_manager_update_available[0]}' self._update_button = bui.buttonwidget(parent=self._root_widget, @@ -2451,7 +2328,7 @@ class PluginManagerSettingsWindow(popup.PopupWindow): size=(0, 0), h_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, color=(0.4, 0.8, 1), maxwidth=width * 0.95) @@ -2460,14 +2337,10 @@ class PluginManagerSettingsWindow(popup.PopupWindow): def toggle_setting(self, setting, set_value): self.settings[setting] = set_value - if self.settings == babase.app.config["Community Plugin Manager"]["Settings"]: - bui.buttonwidget(edit=self._save_button, - scale=0, - selectable=False) - else: - bui.buttonwidget(edit=self._save_button, - scale=1, - selectable=True) + check = self.settings == babase.app.config["Community Plugin Manager"]["Settings"] + bui.buttonwidget(edit=self._save_button, + scale=0 if check else 1, + selectable=(not check)) def save_settings_button(self): babase.app.config["Community Plugin Manager"]["Settings"] = self.settings.copy() @@ -2494,80 +2367,57 @@ class PluginManagerSettingsWindow(popup.PopupWindow): bui.containerwidget(edit=self._root_widget, transition='out_scale') -class NewAllSettingsWindow(bui.Window): +class NewAllSettingsWindow(AllSettingsWindow): """Window for selecting a settings category.""" def __init__( self, - transition: str = 'in_right', + transition: str | None = 'in_right', origin_widget: bui.Widget | None = None, ): # pylint: disable=too-many-statements # pylint: disable=too-many-locals - - # Preload some modules we use in a background thread so we won't - # have a visual hitch when the user taps them. - Thread(target=self._preload_modules).start() - - bui.set_analytics_screen('Settings Window') - scale_origin: tuple[float, float] | None - if origin_widget is not None: - self._transition_out = 'out_scale' - scale_origin = origin_widget.get_screen_space_center() - transition = 'in_scale' - else: - self._transition_out = 'out_right' - scale_origin = None assert bui.app.classic is not None - width = 900 if _uiscale is bui.UIScale.SMALL else 670 - x_inset = 75 if _uiscale is bui.UIScale.SMALL else 0 - height = 435 - self._r = 'settingsWindow' - top_extra = 20 if _uiscale is bui.UIScale.SMALL else 0 + uiscale = bui.app.ui_v1.uiscale + width = 1000 if uiscale is bui.UIScale.SMALL else 800 + x_inset = 125 if uiscale is bui.UIScale.SMALL else 105 + height = 490 + top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 + self._plugman_button = None - super().__init__( - root_widget=bui.containerwidget( - size=(width, height + top_extra), - transition=transition, - toolbar_visibility='menu_minimal', - scale_origin_stack_offset=scale_origin, - scale=( - 1.75 - if _uiscale is bui.UIScale.SMALL - else 1.35 - if _uiscale is bui.UIScale.MEDIUM - else 1.0 - ), - stack_offset=(0, -8) - if _uiscale is bui.UIScale.SMALL - else (0, 0), - ) + super().__init__(transition, origin_widget) + + for child in self._root_widget.get_children(): + child.delete() + + bui.containerwidget( + edit=self._root_widget, size=(width, height + top_extra) ) - if bui.app.ui_v1.use_toolbars and _uiscale is bui.UIScale.SMALL: + if uiscale is bui.UIScale.SMALL: self._back_button = None bui.containerwidget( - edit=self._root_widget, on_cancel_call=self._do_back + edit=self._root_widget, on_cancel_call=self.main_window_back ) else: self._back_button = btn = bui.buttonwidget( parent=self._root_widget, autoselect=True, - position=(40 + x_inset, height - 55), + position=(x_inset - 20, height - 85), size=(130, 60), scale=0.8, text_scale=1.2, label=bui.Lstr(resource='backText'), button_type='back', - on_activate_call=self._do_back, + on_activate_call=self.main_window_back, ) bui.containerwidget(edit=self._root_widget, cancel_button=btn) bui.textwidget( parent=self._root_widget, - position=(0, height - 44), + position=(0, height - 80), size=(width, 25), - text=bui.Lstr(resource=self._r + '.titleText'), + text=bui.Lstr(resource=f'{self._r}.titleText'), color=bui.app.ui_v1.title_color, h_align='center', v_align='center', @@ -2582,19 +2432,21 @@ class NewAllSettingsWindow(bui.Window): label=bui.charstr(bui.SpecialChar.BACK), ) - v = height - 80 - v -= 145 - - basew = 200 - baseh = 160 + v = height - 265 + basew = 280 if uiscale is bui.UIScale.SMALL else 230 + baseh = 170 x_offs = ( - x_inset + (105 if _uiscale is bui.UIScale.SMALL else 72) - basew + x_inset + (105 if uiscale is bui.UIScale.SMALL else 72) - basew ) # now unused + x_dif = (basew - 7) / 2 x_offs2 = x_offs + basew - 7 x_offs3 = x_offs + 2 * (basew - 7) x_offs4 = x_offs + 3 * (basew - 7) - x_offs5 = x_offs2 + 0.5 * (basew - 7) - x_offs6 = x_offs5 + (basew - 7) + x_offs5 = x_offs2 + x_offs6 = x_offs3 + x_offs2 -= x_dif + x_offs3 -= x_dif + x_offs4 -= x_dif def _b_title( x: float, y: float, button: bui.Widget, text: str | bui.Lstr @@ -2620,11 +2472,11 @@ class NewAllSettingsWindow(bui.Window): label='', on_activate_call=self._do_controllers, ) - if bui.app.ui_v1.use_toolbars and self._back_button is None: + if self._back_button is None: bbtn = bui.get_special_widget('back_button') bui.widget(edit=ctb, left_widget=bbtn) _b_title( - x_offs2, v, ctb, bui.Lstr(resource=self._r + '.controllersText') + x_offs2, v, ctb, bui.Lstr(resource=f'{self._r}.controllersText') ) imgw = imgh = 130 bui.imagewidget( @@ -2644,10 +2496,9 @@ class NewAllSettingsWindow(bui.Window): label='', on_activate_call=self._do_graphics, ) - if bui.app.ui_v1.use_toolbars: - pbtn = bui.get_special_widget('party_button') - bui.widget(edit=gfxb, up_widget=pbtn, right_widget=pbtn) - _b_title(x_offs3, v, gfxb, bui.Lstr(resource=self._r + '.graphicsText')) + pbtn = bui.get_special_widget('squad_button') + bui.widget(edit=gfxb, up_widget=pbtn, right_widget=pbtn) + _b_title(x_offs3, v, gfxb, bui.Lstr(resource=f'{self._r}.graphicsText')) imgw = imgh = 110 bui.imagewidget( parent=self._root_widget, @@ -2666,7 +2517,7 @@ class NewAllSettingsWindow(bui.Window): label='', on_activate_call=self._do_audio, ) - _b_title(x_offs4, v, abtn, bui.Lstr(resource=self._r + '.audioText')) + _b_title(x_offs4, v, abtn, bui.Lstr(resource=f'{self._r}.audioText')) imgw = imgh = 120 bui.imagewidget( parent=self._root_widget, @@ -2688,7 +2539,7 @@ class NewAllSettingsWindow(bui.Window): label='', on_activate_call=self._do_advanced, ) - _b_title(x_offs5, v, avb, bui.Lstr(resource=self._r + '.advancedText')) + _b_title(x_offs5, v, avb, bui.Lstr(resource=f'{self._r}.advancedText')) imgw = imgh = 120 bui.imagewidget( parent=self._root_widget, @@ -2699,160 +2550,35 @@ class NewAllSettingsWindow(bui.Window): draw_controller=avb, ) - mmb = self._modmgr_button = bui.buttonwidget(parent=self._root_widget, - autoselect=True, - position=(x_offs6, v), - size=(basew, baseh), - button_type="square", - label="", - on_activate_call=self._do_modmanager) - _b_title(x_offs6, v, mmb, bui.Lstr(value="Plugin Manager")) - imgw = imgh = 112 - bui.imagewidget(parent=self._root_widget, - position=(x_offs6 + basew * 0.49 - imgw * 0.5 + 5, - v + 35), - size=(imgw, imgh), - color=(0.8, 0.95, 1), - texture=bui.gettexture("storeIcon"), - draw_controller=mmb) - + self._plugman_button = pmb = bui.buttonwidget( + parent=self._root_widget, + autoselect=True, + position=(x_offs6, v), + size=(basew, baseh), + button_type='square', + label='', + on_activate_call=self._do_plugman, + ) + _b_title(x_offs6, v, pmb, bui.Lstr(value="Plugin Manager")) + imgw = imgh = 120 + bui.imagewidget( + parent=self._root_widget, + position=(x_offs6 + basew * 0.49 - imgw * 0.5 + 5, v + 35), + size=(imgw, imgh), + color=(0.8, 0.95, 1), + texture=bui.gettexture('storeIcon'), + draw_controller=pmb, + ) self._restore_state() - # noinspection PyUnresolvedReferences - @staticmethod - def _preload_modules() -> None: - """Preload modules we use (called in bg thread).""" - import bauiv1lib.mainmenu as _unused1 - import bauiv1lib.settings.controls as _unused2 - import bauiv1lib.settings.graphics as _unused3 - import bauiv1lib.settings.audio as _unused4 - import bauiv1lib.settings.advanced as _unused5 + def _do_plugman(self) -> None: + # no-op if we're not in control. + if not self.main_window_has_control(): + return - def _do_back(self) -> None: - # pylint: disable=cyclic-import - from bauiv1lib.mainmenu import MainMenuWindow - - self._save_state() - bui.containerwidget( - edit=self._root_widget, transition=self._transition_out + self.main_window_replace( + PluginManagerWindow(origin_widget=self._plugman_button) ) - assert bui.app.classic is not None - if TARGET_BALLISTICA_BUILD < 21697: - # from_window parameter was added in 1.7.30, see changelogs below - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1730-build-21697-api-8-2023-12-08 - # Adding a check here so older builds still work fine. - bui.app.ui_v1.set_main_menu_window( - MainMenuWindow(transition='in_left').get_root_widget(),) - else: - bui.app.ui_v1.set_main_menu_window( - MainMenuWindow(transition='in_left').get_root_widget(), - from_window=self._root_widget,) - - def _do_controllers(self) -> None: - # pylint: disable=cyclic-import - from bauiv1lib.settings.controls import ControlsSettingsWindow - - self._save_state() - bui.containerwidget(edit=self._root_widget, transition='out_left') - assert bui.app.classic is not None - if TARGET_BALLISTICA_BUILD < 21697: - # from_window parameter was added in 1.7.30, see changelogs below - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1730-build-21697-api-8-2023-12-08 - # Adding a check here so older builds still work fine. - bui.app.ui_v1.set_main_menu_window( - ControlsSettingsWindow( - origin_widget=self._controllers_button - ).get_root_widget(),) - else: - bui.app.ui_v1.set_main_menu_window( - ControlsSettingsWindow( - origin_widget=self._controllers_button - ).get_root_widget(), - from_window=self._root_widget,) - - def _do_graphics(self) -> None: - # pylint: disable=cyclic-import - from bauiv1lib.settings.graphics import GraphicsSettingsWindow - - self._save_state() - bui.containerwidget(edit=self._root_widget, transition='out_left') - assert bui.app.classic is not None - if TARGET_BALLISTICA_BUILD < 21697: - # from_window parameter was added in 1.7.30, see changelogs below - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1730-build-21697-api-8-2023-12-08 - # Adding a check here so older builds still work fine. - bui.app.ui_v1.set_main_menu_window( - GraphicsSettingsWindow( - origin_widget=self._graphics_button - ).get_root_widget(),) - else: - bui.app.ui_v1.set_main_menu_window( - GraphicsSettingsWindow( - origin_widget=self._graphics_button - ).get_root_widget(), - from_window=self._root_widget,) - - def _do_audio(self) -> None: - # pylint: disable=cyclic-import - from bauiv1lib.settings.audio import AudioSettingsWindow - - self._save_state() - bui.containerwidget(edit=self._root_widget, transition='out_left') - assert bui.app.classic is not None - if TARGET_BALLISTICA_BUILD < 21697: - # from_window parameter was added in 1.7.30, see changelogs below - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1730-build-21697-api-8-2023-12-08 - # Adding a check here so older builds still work fine. - bui.app.ui_v1.set_main_menu_window( - AudioSettingsWindow( - origin_widget=self._audio_button - ).get_root_widget(),) - else: - bui.app.ui_v1.set_main_menu_window( - AudioSettingsWindow( - origin_widget=self._audio_button - ).get_root_widget(), - from_window=self._root_widget,) - - def _do_advanced(self) -> None: - # pylint: disable=cyclic-import - from bauiv1lib.settings.advanced import AdvancedSettingsWindow - - self._save_state() - bui.containerwidget(edit=self._root_widget, transition='out_left') - assert bui.app.classic is not None - if TARGET_BALLISTICA_BUILD < 21697: - # from_window parameter was added in 1.7.30, see changelogs below - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1730-build-21697-api-8-2023-12-08 - # Adding a check here so older builds still work fine. - bui.app.ui_v1.set_main_menu_window( - AdvancedSettingsWindow( - origin_widget=self._advanced_button - ).get_root_widget()) - else: - bui.app.ui_v1.set_main_menu_window( - AdvancedSettingsWindow( - origin_widget=self._advanced_button - ).get_root_widget(), - from_window=self._root_widget,) - - def _do_modmanager(self) -> None: - self._save_state() - bui.containerwidget(edit=self._root_widget, transition="out_left") - if TARGET_BALLISTICA_BUILD < 21697: - # from_window parameter was added in 1.7.30, see changelogs below - # https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1730-build-21697-api-8-2023-12-08 - # Adding a check here so older builds still work fine. - bui.app.ui_v1.set_main_menu_window( - PluginManagerWindow( - origin_widget=self._modmgr_button - ).get_root_widget(),) - else: - bui.app.ui_v1.set_main_menu_window( - PluginManagerWindow( - origin_widget=self._modmgr_button - ).get_root_widget(), - from_window=self._root_widget,) def _save_state(self) -> None: try: @@ -2865,16 +2591,14 @@ class NewAllSettingsWindow(bui.Window): sel_name = 'Audio' elif sel == self._advanced_button: sel_name = 'Advanced' - elif sel == self._modmgr_button: - sel_name = 'Mod Manager' + elif sel == self._plugman_button: + sel_name = 'PlugMan' elif sel == self._back_button: sel_name = 'Back' else: raise ValueError(f'unrecognized selection \'{sel}\'') assert bui.app.classic is not None - bui.app.ui_v1.window_states[type(self)] = { - 'sel_name': sel_name - } + bui.app.ui_v1.window_states[type(self)] = {'sel_name': sel_name} except Exception: logging.exception('Error saving state for %s.', self) @@ -2893,8 +2617,8 @@ class NewAllSettingsWindow(bui.Window): sel = self._audio_button elif sel_name == 'Advanced': sel = self._advanced_button - elif sel_name == "Mod Manager": - sel = self._modmgr_button + elif sel_name == "PlugMan": + sel = self._plugman_button elif sel_name == 'Back': sel = self._back_button else: diff --git a/plugins/utilities.json b/plugins/utilities.json index fb8f993..9b721a0 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -33,6 +33,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "f5b3db1774924f90381e3e4abb7b6278" + }, "1.0.0": { "api_version": 8, "commit_sha": "667397e", @@ -71,6 +77,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "90cbaf7", + "released_on": "22-01-2025", + "md5sum": "b287c940c143bf9c4831477742dbd913" + }, "1.0.0": { "api_version": 8, "commit_sha": "333416f", @@ -90,6 +102,12 @@ } ], "versions": { + "2.0.1": { + "api_version": 9, + "commit_sha": "506451f", + "released_on": "21-01-2025", + "md5sum": "13385447ed5cc2d34396a5f57b0aed67" + }, "2.0.0": { "api_version": 8, "commit_sha": "333416f", @@ -109,6 +127,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bbd7753", + "released_on": "22-01-2025", + "md5sum": "7a30597198881b7a1cee2a220230b934" + }, "1.0.0": { "api_version": 8, "commit_sha": "333416f", @@ -128,6 +152,12 @@ } ], "versions": { + "2.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "1b41b40775ed6fd98a2e3a4c4de4778e" + }, "2.0.0": { "api_version": 8, "commit_sha": "333416f", @@ -147,6 +177,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "da4f281188f46d0c8e518c57c17144d4" + }, "1.0.0": { "api_version": 8, "commit_sha": "fcda5f0", @@ -171,6 +207,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "2d12dd560558b87f3f1fd6f134f397b8" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -196,6 +238,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "022f879", + "released_on": "23-01-2025", + "md5sum": "78a27e0fce1965ffcfdb055c33d49185" + }, "1.0.0": { "api_version": 8, "commit_sha": "c26342d", @@ -215,6 +263,12 @@ } ], "versions": { + "1.4.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "80a8469d7340e59b5c7754a2b5c48ccd" + }, "1.3.2": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -270,6 +324,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "04a6d85404f51b3026060d9525c14b09" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -295,6 +355,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "b52d84a", + "released_on": "21-01-2025", + "md5sum": "cc2d3d06a20f4c9de3f3fa3d7eccf46c" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -345,6 +411,12 @@ } ], "versions": { + "1.0.2": { + "api_version": 9, + "commit_sha": "37914bb", + "released_on": "21-01-2025", + "md5sum": "c1f8a382f0f64777b5415c82d6913ff2" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -400,6 +472,12 @@ } ], "versions": { + "1.3.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "499ccd84ac8deedef5596dccad2a58b7" + }, "1.2.3": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -448,6 +526,12 @@ } ], "versions": { + "2.2.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "ce3ed59ed6009ced568b94105c10ae42" + }, "2.1.0": { "api_version": 8, "commit_sha": "464eb7c", @@ -503,6 +587,12 @@ } ], "versions": { + "2.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "48896fb8a1ecfdb1ce382b06db315854" + }, "2.0.0": { "api_version": 8, "commit_sha": "c41cc10", @@ -528,6 +618,12 @@ } ], "versions": { + "2.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "02857d12efabced28a6d980756143aeb" + }, "2.0.0": { "api_version": 8, "commit_sha": "48f9302", @@ -553,6 +649,12 @@ } ], "versions": { + "2.0.2": { + "api_version": 9, + "commit_sha": "2c66eac", + "released_on": "21-01-2025", + "md5sum": "37a68c15b66a2deca923317db9d4c630" + }, "2.0.1": { "api_version": 8, "commit_sha": "1d45e69", @@ -590,6 +692,12 @@ } ], "versions": { + "3.0.0": { + "api_version": 9, + "commit_sha": "32e5180", + "released_on": "22-01-2025", + "md5sum": "b1742bdaf76b60a2eaf62cdcfebdbd52" + }, "2.0.0": { "api_version": 8, "commit_sha": "0c5ce76", @@ -627,6 +735,12 @@ } ], "versions": { + "2.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "2929a3af42ee3547864878a77a4c66a1" + }, "2.0.2": { "api_version": 8, "commit_sha": "32e0f45", @@ -670,6 +784,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "8982f0e", + "released_on": "22-01-2025", + "md5sum": "df20190b079bbf80f1e061339930e5f7" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -695,6 +815,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "cb06090af5beb9f80965342b9a83b1e9" + }, "1.0.2": { "api_version": 8, "commit_sha": "505c948", @@ -757,6 +883,12 @@ } ], "versions": { + "2.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "56d3b51b5929a53a7d2de04326ea7bae" + }, "2.0.0": { "api_version": 8, "commit_sha": "0c5ce76", @@ -782,6 +914,12 @@ } ], "versions": { + "2.1.0": { + "api_version": 9, + "commit_sha": "94742b9", + "released_on": "21-01-2025", + "md5sum": "6fa2e76b9d90ab9a7b801c2245f1a017" + }, "2.0.1": { "api_version": 8, "commit_sha": "a3a48c2", @@ -819,6 +957,12 @@ } ], "versions": { + "3.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "d94cc8a8a6cef495a6e09d019ebe3eb9" + }, "3.0.1": { "api_version": 8, "commit_sha": "78f3c44", @@ -900,6 +1044,12 @@ } ], "versions": { + "3.0.2": { + "api_version": 9, + "commit_sha": "43b3a41", + "released_on": "21-01-2025", + "md5sum": "3f6ad4656e2a04fc1a767f2760407c7b" + }, "3.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -925,6 +1075,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "90aaf343cf22eb024665ec5a7a4889c0" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -950,6 +1106,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "4281fd65d90f314d3c8180505856a9d3" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -975,6 +1137,12 @@ } ], "versions": { + "2.2.0": { + "api_version": 9, + "commit_sha": "04b8460", + "released_on": "21-01-2025", + "md5sum": "2c78b1e3918053fa94d709571fef624d" + }, "2.1.0": { "api_version": 8, "commit_sha": "41046ae", @@ -1067,6 +1235,12 @@ } ], "versions": { + "1.3.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "e9b9817c356101038e4f3b522311c4a6" + }, "1.2.0": { "api_version": 8, "commit_sha": "41046ae", @@ -1086,6 +1260,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "f269311e8c321f912940c8127e4c6c29" + }, "1.0.2": { "api_version": 8, "commit_sha": "95076d1", @@ -1117,6 +1297,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "b33c016195bc17c3ebd878570c9e3fa6" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -1142,6 +1328,12 @@ } ], "versions": { + "1.2.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "96815ba9a784ca0004ce6580eedd9b57" + }, "1.0.1": { "api_version": 8, "commit_sha": "2b5c9ee", @@ -1167,6 +1359,12 @@ } ], "versions": { + "1.1.1": { + "api_version": 9, + "commit_sha": "3540260", + "released_on": "21-01-2025", + "md5sum": "94270effa9a80a138a9c083aca087fd7" + }, "1.1.0": { "api_version": 8, "commit_sha": "5fb8195", @@ -1223,6 +1421,12 @@ } ], "versions": { + "1.5.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "af4ec55092fb22d2799d63e19c599464" + }, "1.4.3": { "api_version": 8, "commit_sha": "f50a546", @@ -1284,6 +1488,12 @@ } ], "versions": { + "1.0.1": { + "api_version": 9, + "commit_sha": "ea64940", + "released_on": "21-01-2025", + "md5sum": "9742d478095ac72b1780b75c17ebeb07" + }, "1.0.0": { "api_version": 8, "commit_sha": "f744c41", @@ -1303,6 +1513,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "85193fe", + "released_on": "21-01-2025", + "md5sum": "03d98165e14886fba7f139f8610686f7" + }, "1.0.0": { "api_version": 8, "commit_sha": "718039b", @@ -1322,6 +1538,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "4cd035b88234f5f082c706d5eb37bd28" + }, "1.0.0": { "api_version": 8, "commit_sha": "718039b", @@ -1341,6 +1563,12 @@ } ], "versions": { + "2.1.0": { + "api_version": 9, + "commit_sha": "7d6ed3d", + "released_on": "22-01-2025", + "md5sum": "c3af893247488915d26585d0957171d8" + }, "2.0.1": { "api_version": 8, "commit_sha": "718039b", @@ -1360,6 +1588,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "e2c6477", + "released_on": "21-01-2025", + "md5sum": "480b825e187e59020b339290966b5c5a" + }, "1.0.0": { "api_version": 8, "commit_sha": "5063690", @@ -1379,6 +1613,12 @@ } ], "versions": { + "1.1.0": { + "api_version": 9, + "commit_sha": "bb129cc", + "released_on": "14-01-2025", + "md5sum": "50e9c3ea8d7e7de5cd491987547c9cf3" + }, "1.0.0": { "api_version": 8, "commit_sha": "4941d0c", diff --git a/plugins/utilities/advanced_party_window.py b/plugins/utilities/advanced_party_window.py index a38d78a..6a1cef9 100644 --- a/plugins/utilities/advanced_party_window.py +++ b/plugins/utilities/advanced_party_window.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# ba_meta require api 8 +# ba_meta require api 9 ''' AdvancedPartyWindow by Mr.Smoothy diff --git a/plugins/utilities/allow_invisible_models.py b/plugins/utilities/allow_invisible_models.py index 4f33761..ec8355f 100644 --- a/plugins/utilities/allow_invisible_models.py +++ b/plugins/utilities/allow_invisible_models.py @@ -1,5 +1,5 @@ # Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 import babase import bascenev1 as bs diff --git a/plugins/utilities/auto_stunt.py b/plugins/utilities/auto_stunt.py index aadf8c7..a166bbc 100644 --- a/plugins/utilities/auto_stunt.py +++ b/plugins/utilities/auto_stunt.py @@ -1,5 +1,4 @@ -# Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 # AutoStunt mod by - Mr.Smoothy x Rikko # https://discord.gg/ucyaesh # https://bombsquad-community.web.app/home @@ -12,15 +11,12 @@ import bauiv1 as bui import bascenev1 as bs import _babase import bascenev1lib -from bascenev1lib.actor.text import Text from bascenev1lib.actor.image import Image from bascenev1lib.actor import spaz -from bascenev1lib.actor import playerspaz from bascenev1lib.gameutils import SharedObjects from bascenev1lib.actor.powerupbox import PowerupBoxFactory from bascenev1lib.actor.spazfactory import SpazFactory from bascenev1lib.game.elimination import EliminationGame -from bauiv1lib import mainmenu import math import json import os @@ -73,10 +69,10 @@ class ControlsUI: channel * 0.5 for channel in activity._bomb_image.node.color[:3]) + [1] def on_move_ud(activity, value): - activity.set_stick_image_position(activity, x=activity.stick_image_position_x, y=value) + activity.set_stick_image_position(activity.stick_image_position_x, value) def on_move_lr(activity, value): - activity.set_stick_image_position(activity, x=value, y=activity.stick_image_position_y) + activity.set_stick_image_position(value, activity.stick_image_position_y) def display(activity): activity._jump_image.node.color = list(activity._jump_image.node.color[:3]) + [1] @@ -296,7 +292,11 @@ def replay(player, stunt_name): def spawn_mirror_spaz(player): player.mirror_mode = True with player.actor._activity().context: - bot = spaz.Spaz(player.color, player.highlight, character=player.character).autoretain() + bot = spaz.Spaz( + color=player.color, + highlight=player.highlight, + character=player.character + ).autoretain() bot.handlemessage(bs.StandMessage( (player.actor.node.position[0], player.actor.node.position[1], player.actor.node.position[2]+1), 93)) bot.node.name = player.actor.node.name @@ -319,10 +319,10 @@ def ghost(player, stunt_name): player.in_replay = True with player.actor._activity().context: - bot = spaz.Spaz((1, 0, 0), character="Spaz").autoretain() + bot = spaz.Spaz(color=(1, 0, 0), character="Spaz").autoretain() bot.handlemessage(bs.StandMessage(player.actor.node.position, 93)) give_ghost_power(bot) - ControlsUI.display(player.actor._activity()) + ControlsUI.display(bot._activity()) for move in stunt: value = move["move"]["value"] if value is None: @@ -427,20 +427,26 @@ def new_chatmessage(msg): if len(msg_splits) < 2: bui.screenmessage("Enter name of stunt eg : *stunt bombjump") return original_chatmessage(msg) - replay(player, stunt_name) - bs.chatmessage('Replaying "{}" on {}.'.format( - stunt_name, - player.getname(), - )) + if player is not None and player.actor is not None: + replay(player, stunt_name) + bs.chatmessage('Replaying "{}" on {}.'.format( + stunt_name, + player.getname(), + )) + else: + bui.screenmessage("Player not found") elif command == "learn": if len(msg_splits) < 2: bui.screenmessage("Enter name of stunt eg : *learn bombjump") return original_chatmessage(msg) - ghost(player, stunt_name) - bs.chatmessage('Replaying "{}" on {}.'.format( - stunt_name, - player.getname(), - )) + if player is not None and player.actor is not None: + ghost(player, stunt_name) + bs.chatmessage('Replaying "{}" on {}.'.format( + stunt_name, + player.getname(), + )) + else: + bui.screenmessage("Player not found") elif command == "mirror": spawn_mirror_spaz(player) return original_chatmessage(msg) @@ -531,23 +537,15 @@ def on_begin(self, *args, **kwargs) -> None: }) self._stick_base_image.opacity = 0.0 self._stick_nub_image.opacity = 0.0 - self.set_stick_image_position = set_stick_image_position return original_on_begin(self, *args, **kwargs) - -class NewMainMenuWindow(mainmenu.MainMenuWindow): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # Display chat icon, but if user open/close gather it may disappear - bui.set_party_icon_always_visible(True) - # ba_meta export plugin class byHeySmoothy(babase.Plugin): def on_app_running(self): - mainmenu.MainMenuWindow = NewMainMenuWindow bs._activity.Activity.on_begin = on_begin + bs._activity.Activity.set_stick_image_position = set_stick_image_position bs.chatmessage = new_chatmessage bascenev1lib.actor.playerspaz.PlayerSpaz = NewPlayerSpaz bascenev1lib.actor.spaz.Spaz = NewSpaz diff --git a/plugins/utilities/autorun.py b/plugins/utilities/autorun.py index 9c36c78..fe710d9 100644 --- a/plugins/utilities/autorun.py +++ b/plugins/utilities/autorun.py @@ -1,5 +1,6 @@ # Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 + +# ba_meta require api 9 """ AutoRun by TheMikirog diff --git a/plugins/utilities/bomb_radius_visualizer.py b/plugins/utilities/bomb_radius_visualizer.py index 8822961..0d69cf6 100644 --- a/plugins/utilities/bomb_radius_visualizer.py +++ b/plugins/utilities/bomb_radius_visualizer.py @@ -1,5 +1,5 @@ # Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 """ Bomb Radius Visualizer by TheMikirog diff --git a/plugins/utilities/bots_can_accept_powerups.py b/plugins/utilities/bots_can_accept_powerups.py index ca7d842..a199f04 100644 --- a/plugins/utilities/bots_can_accept_powerups.py +++ b/plugins/utilities/bots_can_accept_powerups.py @@ -1,5 +1,5 @@ # Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations diff --git a/plugins/utilities/character_chooser.py b/plugins/utilities/character_chooser.py index da12dbb..8488d54 100644 --- a/plugins/utilities/character_chooser.py +++ b/plugins/utilities/character_chooser.py @@ -1,4 +1,4 @@ -# ba_meta require api 8 +# ba_meta require api 9 ''' Character Chooser by Mr.Smoothy diff --git a/plugins/utilities/character_maker.py b/plugins/utilities/character_maker.py index d417a5b..074d2d2 100644 --- a/plugins/utilities/character_maker.py +++ b/plugins/utilities/character_maker.py @@ -1,6 +1,6 @@ # Released under the MIT License. See LICENSE for details. -# ba_meta require api 8 +# ba_meta require api 9 ''' @@ -748,27 +748,11 @@ def get_player(msg, activity): return player -old_piv = bui.set_party_icon_always_visible - - -def new_piv(*args, **kwargs): - old_piv(True) - - -bui.set_party_icon_always_visible = new_piv - - -class NewMainMenuWindow(bauiv1lib.mainmenu.MainMenuWindow): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - bui.set_party_icon_always_visible(True) - # ba_meta export plugin class bySmoothy(babase.Plugin): def __init__(self): - bauiv1lib.mainmenu.MainMenuWindow = NewMainMenuWindow _babase.import_character = import_character _babase.export_character = export_character _babase.spaz_to_json = spaz_to_json diff --git a/plugins/utilities/colored_bomb_explosion_patches.py b/plugins/utilities/colored_bomb_explosion_patches.py index 813989e..6a756c1 100644 --- a/plugins/utilities/colored_bomb_explosion_patches.py +++ b/plugins/utilities/colored_bomb_explosion_patches.py @@ -1,13 +1,10 @@ -# Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 -# (see https://ballistica.net/wiki/meta-tag-system) +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING import babase -import bauiv1 as bui import bascenev1 as bs import random from bascenev1lib.actor import bomb @@ -19,6 +16,7 @@ if TYPE_CHECKING: class NewBlast(bomb.Blast): def __init__( self, + *, position: Sequence[float] = (0.0, 1.0, 0.0), velocity: Sequence[float] = (0.0, 0.0, 0.0), blast_radius: float = 2.0, @@ -27,9 +25,16 @@ class NewBlast(bomb.Blast): hit_type: str = 'explosion', hit_subtype: str = 'normal', ): - super().__init__(position, velocity, blast_radius, blast_type, - source_player, hit_type, hit_subtype) - scorch_radius = light_radius = self.radius + super().__init__( + position=position, + velocity=velocity, + blast_radius=blast_radius, + blast_type=blast_type, + source_player=source_player, + hit_type=hit_type, + hit_subtype=hit_subtype + ) + scorch_radius = self.radius if self.blast_type == 'tnt': scorch_radius *= 1.15 scorch = bs.newnode( diff --git a/plugins/utilities/colorscheme.py b/plugins/utilities/colorscheme.py index a2998e3..0657c57 100644 --- a/plugins/utilities/colorscheme.py +++ b/plugins/utilities/colorscheme.py @@ -6,7 +6,7 @@ # Settings -> Advanced -> Enter Code # to bring up the colorscheme UI. -# ba_meta require api 8 +# ba_meta require api 9 import _babase import babase import bauiv1 as bui diff --git a/plugins/utilities/custom_death.py b/plugins/utilities/custom_death.py index bc8a66b..f6d23d2 100644 --- a/plugins/utilities/custom_death.py +++ b/plugins/utilities/custom_death.py @@ -1,5 +1,5 @@ # Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations diff --git a/plugins/utilities/disable_friendly_fire.py b/plugins/utilities/disable_friendly_fire.py index e8bf84e..699c40e 100644 --- a/plugins/utilities/disable_friendly_fire.py +++ b/plugins/utilities/disable_friendly_fire.py @@ -1,10 +1,8 @@ -# Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING import babase -import bauiv1 as bui import bascenev1 as bs import bascenev1lib from bascenev1lib.gameutils import SharedObjects diff --git a/plugins/utilities/disco_light.py b/plugins/utilities/disco_light.py index fc03d80..b517d73 100644 --- a/plugins/utilities/disco_light.py +++ b/plugins/utilities/disco_light.py @@ -18,7 +18,7 @@ Made by Cross Joy""" # Coop and multiplayer compatible. -# Work on any 1.7.20+ ver. +# Work on any 1.7.37+ ver. # Note: # The plugin commands only works on the host with the plugin activated. @@ -30,24 +30,18 @@ Made by Cross Joy""" # ---------------------------------------------------------------------------- -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations -from typing import TYPE_CHECKING - import bascenev1 as bs import babase -import bauiv1 as bui from bascenev1 import _gameutils import random from bascenev1 import animate -if TYPE_CHECKING: - from typing import Sequence, Union - class DiscoLight: @@ -213,20 +207,8 @@ def new_chat_message(func): return wrapper -def new_begin(func): - """Runs when game is began.""" - - def wrapper(*args, **kwargs): - func(*args, **kwargs) - bui.set_party_icon_always_visible(True) - - return wrapper - - # ba_meta export plugin class ByCrossJoy(babase.Plugin): def __init__(self): # Replace new chat func to the original game codes. bs.chatmessage = new_chat_message(bs.chatmessage) - bs._activity.Activity.on_begin = new_begin( - bs._activity.Activity.on_begin) diff --git a/plugins/utilities/discord_richpresence.py b/plugins/utilities/discord_richpresence.py index 0ae250a..323dc4c 100644 --- a/plugins/utilities/discord_richpresence.py +++ b/plugins/utilities/discord_richpresence.py @@ -2,7 +2,7 @@ # """placeholder :clown:""" -# ba_meta require api 8 +# ba_meta require api 9 #!"Made to you by @brostos & @Dliwk" diff --git a/plugins/utilities/easy_connect.py b/plugins/utilities/easy_connect.py index c925515..7faf647 100644 --- a/plugins/utilities/easy_connect.py +++ b/plugins/utilities/easy_connect.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# ba_meta require api 8 +# ba_meta require api 9 ''' =========================================== EasyConnect by Mr.Smoothy | verion 1.7 | https://discord.gg/ucyaesh | Serverconnector X IPPORTRevealer | - for bombsquad v1.7.20+ | + for bombsquad v1.7.37+ | ============================================== ''' @@ -26,9 +26,9 @@ # https://discord.gg/ucyaesh # REQUIREMENTS -# built for bs 1.7.20 and above +# built for bs 1.7.37 and above -# by Mr.Smoothy for Bombsquad version 1.7.20+ +# by Mr.Smoothy for Bombsquad version 1.7.37+ import _babase import babase @@ -40,7 +40,7 @@ from bauiv1lib import popup from dataclasses import dataclass import random from enum import Enum -from bauiv1lib.popup import PopupMenuWindow, PopupWindow +from bauiv1lib.popup import PopupMenuWindow from typing import Any, Optional, Callable from bauiv1lib.gather.publictab import PublicGatherTab import json @@ -114,12 +114,12 @@ class _HostLookupThread(threading.Thread): from_other_thread=True) -def newbuild_favorites_tab(self, region_height: float) -> None: +def newbuild_favorites_tab(self, region_width: float, region_height: float) -> None: c_height = region_height - 20 v = c_height - 35 - 25 - 30 self.retry_inter = 0.0 uiscale = bui.app.ui_v1.uiscale - self._width = 1240 if uiscale is babase.UIScale.SMALL else 1040 + self._width = region_width x_inset = 100 if uiscale is babase.UIScale.SMALL else 0 self._height = (578 if uiscale is babase.UIScale.SMALL else 670 if uiscale is babase.UIScale.MEDIUM else 800) @@ -241,6 +241,23 @@ def newbuild_favorites_tab(self, region_height: float) -> None: border=2, margin=0, claims_left_right=True) + self._no_parties_added_text = bui.textwidget( + parent=self._container, + size=(0, 0), + h_align='center', + v_align='center', + text='', + color=(0.6, 0.6, 0.6), + scale=1.2, + position=( + ( + (240 if uiscale is bui.UIScale.SMALL else 225) + + sub_scroll_width * 0.5 + ), + v + sub_scroll_height * 0.5, + ), + glow_type='uniform', + ) self._favorite_selected = None self._refresh_favorites() diff --git a/plugins/utilities/file_share.py b/plugins/utilities/file_share.py index 4b9a546..709baad 100644 --- a/plugins/utilities/file_share.py +++ b/plugins/utilities/file_share.py @@ -1,4 +1,4 @@ -# ba_meta require api 8 +# ba_meta require api 9 ''' File Share Mod for BombSquad 1.7.30 and above. https://youtu.be/qtGsFU4cgic diff --git a/plugins/utilities/floater.py b/plugins/utilities/floater.py index 0f0ec64..bbd9a89 100644 --- a/plugins/utilities/floater.py +++ b/plugins/utilities/floater.py @@ -8,10 +8,8 @@ # https://github.com/Freaku17/BombSquad-Mods-byFreaku -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations -from typing import TYPE_CHECKING -import _babase import babase import random import math @@ -20,10 +18,6 @@ import bascenev1 as bs from bascenev1lib.gameutils import SharedObjects from bascenev1lib.actor.bomb import Bomb from bascenev1lib.actor.popuptext import PopupText -from bauiv1lib.party import PartyWindow -import bauiv1lib.mainmenu -if TYPE_CHECKING: - from typing import Optional class Floater(bs.Actor): @@ -253,23 +247,13 @@ def assignFloInputs(clientID: int): i.assigninput(babase.InputType.PICK_UP_PRESS, floater.up) i.assigninput(babase.InputType.PICK_UP_RELEASE, floater.upR) i.assigninput(babase.InputType.JUMP_PRESS, floater.down) + i.assigninput(babase.InputType.JUMP_RELEASE, floater.downR) i.assigninput(babase.InputType.BOMB_PRESS, floater.drop) i.assigninput(babase.InputType.PUNCH_PRESS, babase.Call(dis, i, floater)) i.assigninput(babase.InputType.UP_DOWN, floater.updown) i.assigninput(babase.InputType.LEFT_RIGHT, floater.leftright) -old_piv = bui.set_party_icon_always_visible - - -def new_piv(*args, **kwargs): - # Do not let chat icon go away - old_piv(True) - - -bui.set_party_icon_always_visible = new_piv - - old_fcm = bs.chatmessage @@ -284,15 +268,8 @@ def new_chat_message(*args, **kwargs): bs.chatmessage = new_chat_message - -class NewMainMenuWindow(bauiv1lib.mainmenu.MainMenuWindow): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # Display chat icon, but if user open/close gather it may disappear - bui.set_party_icon_always_visible(True) - - # ba_meta export plugin + + class byFreaku(babase.Plugin): - def on_app_running(self): - bauiv1lib.mainmenu.MainMenuWindow = NewMainMenuWindow + def on_app_running(self): pass diff --git a/plugins/utilities/health_indicator.py b/plugins/utilities/health_indicator.py index 52d8f8b..ca08afe 100644 --- a/plugins/utilities/health_indicator.py +++ b/plugins/utilities/health_indicator.py @@ -14,7 +14,7 @@ For 1.7.20+""" # Add a simple health indicator on every player and bot. -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations diff --git a/plugins/utilities/icons_keyboard.py b/plugins/utilities/icons_keyboard.py index ff29a50..f42e1d6 100644 --- a/plugins/utilities/icons_keyboard.py +++ b/plugins/utilities/icons_keyboard.py @@ -7,7 +7,7 @@ # Tap bottom-left bomb button to cycle through different icons -# ba_meta require api 8 +# ba_meta require api 9 import bauiv1 import babase diff --git a/plugins/utilities/infinity_shield.py b/plugins/utilities/infinity_shield.py index 9510452..03dfa08 100644 --- a/plugins/utilities/infinity_shield.py +++ b/plugins/utilities/infinity_shield.py @@ -1,18 +1,18 @@ -# Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 -# (see https://ballistica.net/wiki/meta-tag-system) +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING import babase -import bauiv1 as bui import bascenev1 as bs import random from bascenev1lib.actor.spaz import Spaz from bascenev1lib.actor.spazfactory import SpazFactory +if TYPE_CHECKING: + from typing import Sequence + if TYPE_CHECKING: pass @@ -21,6 +21,7 @@ Spaz._old_init = Spaz.__init__ def __init__(self, + *, color: Sequence[float] = (1.0, 1.0, 1.0), highlight: Sequence[float] = (0.5, 0.5, 0.5), character: str = 'Spaz', @@ -29,8 +30,16 @@ def __init__(self, can_accept_powerups: bool = True, powerups_expire: bool = False, demo_mode: bool = False): - self._old_init(color, highlight, character, source_player, start_invincible, - can_accept_powerups, powerups_expire, demo_mode) + self._old_init( + color=color, + highlight=highlight, + character=character, + source_player=source_player, + start_invincible=start_invincible, + can_accept_powerups=can_accept_powerups, + powerups_expire=powerups_expire, + demo_mode=demo_mode + ) if self.source_player: self.equip_shields() diff --git a/plugins/utilities/manual_camera.py b/plugins/utilities/manual_camera.py index cb944b4..83b87b1 100644 --- a/plugins/utilities/manual_camera.py +++ b/plugins/utilities/manual_camera.py @@ -1,4 +1,4 @@ -# ba_meta require api 8 +# ba_meta require api 9 ################### # Credits - Droopy#3730. # @@ -10,16 +10,20 @@ from __future__ import annotations import _babase import babase -import bascenev1 as bs import bauiv1 as bui -from bauiv1lib.mainmenu import MainMenuWindow +from bauiv1lib.ingamemenu import InGameMenuWindow -class Manual_camera_window: - def __init__(self): - self._root_widget = bui.containerwidget( - on_outside_click_call=None, - size=(0, 0)) +class Manual_camera_window(bui.MainWindow): + def __init__(self, origin_widget): + super().__init__( + root_widget=bui.containerwidget( + on_outside_click_call=None, + size=(0, 0) + ), + transition='in_scale', + origin_widget=origin_widget, + ) button_size = (50, 50) self._text = bui.textwidget(parent=self._root_widget, scale=0.65, @@ -149,15 +153,10 @@ class Manual_camera_window: button_type='square', autoselect=True, position=(520, -100), - on_activate_call=self._close) + on_activate_call=self.main_window_back) bui.containerwidget(edit=self._root_widget, cancel_button=self._done) - def _close(self): - bui.containerwidget(edit=self._root_widget, - transition=('out_scale')) - MainMenuWindow() - def _change_camera_position(self, direction): camera = _babase.get_camera_position() x = camera[0] @@ -212,7 +211,7 @@ class Manual_camera_window: _babase.set_camera_target(x, y, z) -old_refresh_in_game = MainMenuWindow._refresh_in_game +old_refresh_in_game = InGameMenuWindow._refresh_in_game def my_refresh_in_game(self, *args, **kwargs): @@ -224,19 +223,23 @@ def my_refresh_in_game(self, *args, **kwargs): size=(70, 50), button_type='square', label='Manual\nCamera', - text_scale=1.5, - on_activate_call=self._manual_camera) + text_scale=1.5) + + bui.buttonwidget(edit=camera_button, + on_activate_call=bui.Call(self._manual_camera, camera_button)) return value -def _manual_camera(self): - bui.containerwidget(edit=self._root_widget, transition='out_scale') - Manual_camera_window() +def _manual_camera(self, widget): + if not self.main_window_has_control(): + return + + self.main_window_replace(Manual_camera_window(origin_widget=widget)) # ba_meta export plugin class ByDroopy(babase.Plugin): def __init__(self): - MainMenuWindow._refresh_in_game = my_refresh_in_game - MainMenuWindow._manual_camera = _manual_camera + InGameMenuWindow._refresh_in_game = my_refresh_in_game + InGameMenuWindow._manual_camera = _manual_camera diff --git a/plugins/utilities/max_players.py b/plugins/utilities/max_players.py index 39d0672..d75477f 100644 --- a/plugins/utilities/max_players.py +++ b/plugins/utilities/max_players.py @@ -1,8 +1,6 @@ -# Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) """===========MAX_PLAYERS===========""" -# ba_meta require api 8 -# (see https://ballistica.net/wiki/meta-tag-system) +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING diff --git a/plugins/utilities/mood_light.py b/plugins/utilities/mood_light.py index 81ca17c..f9f37d8 100644 --- a/plugins/utilities/mood_light.py +++ b/plugins/utilities/mood_light.py @@ -1,5 +1,5 @@ # Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING, cast if TYPE_CHECKING: diff --git a/plugins/utilities/only_night.py b/plugins/utilities/only_night.py index b337647..873181d 100644 --- a/plugins/utilities/only_night.py +++ b/plugins/utilities/only_night.py @@ -2,7 +2,7 @@ # Tool used to make porting easier.(https://github.com/bombsquad-community/baport) """Only Night.""" -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations diff --git a/plugins/utilities/party_filter.py b/plugins/utilities/party_filter.py index 5670f95..e7114cf 100644 --- a/plugins/utilities/party_filter.py +++ b/plugins/utilities/party_filter.py @@ -214,7 +214,7 @@ class EnhancedPublicGatherTab(PublicGatherTab): self._parties_sorted = [p for p in self._parties_sorted if p[1].size == 0] -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export babase.Plugin class ByYelllow(babase.Plugin): def on_app_running(self) -> None: diff --git a/plugins/utilities/quickturn.py b/plugins/utilities/quickturn.py index 80a5cd5..610a887 100644 --- a/plugins/utilities/quickturn.py +++ b/plugins/utilities/quickturn.py @@ -1,4 +1,3 @@ -# Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) """ Quickturn by TheMikirog @@ -10,18 +9,16 @@ No Rights Reserved """ -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING import babase -import bauiv1 as bui import bascenev1 as bs import math import bascenev1lib -from bascenev1lib.actor.spaz import Spaz if TYPE_CHECKING: pass diff --git a/plugins/utilities/ragdoll_b_gone.py b/plugins/utilities/ragdoll_b_gone.py index 996160a..00958bd 100644 --- a/plugins/utilities/ragdoll_b_gone.py +++ b/plugins/utilities/ragdoll_b_gone.py @@ -1,5 +1,5 @@ # Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 """ Ragdoll-B-Gone by TheMikirog diff --git a/plugins/utilities/random_join.py b/plugins/utilities/random_join.py index 6d37d89..81d654f 100644 --- a/plugins/utilities/random_join.py +++ b/plugins/utilities/random_join.py @@ -309,7 +309,7 @@ class RandomJoin: randomjoin = RandomJoin() -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export babase.Plugin class RandomJoinPlugin(babase.Plugin): def on_app_running(self) -> None: diff --git a/plugins/utilities/random_play.py b/plugins/utilities/random_play.py index a07b906..208e64b 100644 --- a/plugins/utilities/random_play.py +++ b/plugins/utilities/random_play.py @@ -1,4 +1,4 @@ -# ba_meta require api 8 +# ba_meta require api 9 from random import choice, randint from typing import Any, Union @@ -15,6 +15,7 @@ from bascenev1 import ( ) from bauiv1 import Widget, UIScale, buttonwidget +from bauiv1lib.play import PlaylistSelectContext from bauiv1lib.playlist.browser import PlaylistBrowserWindow from bascenev1lib.activity.multiteamjoin import MultiTeamJoinActivity @@ -127,14 +128,15 @@ def patched__init__( sessiontype: type[Session], transition: str | None = "in_right", origin_widget: Widget | None = None, + playlist_select_context: PlaylistSelectContext | None = None, ): width = 800 height = 650 ui_scale = babase.app.ui_v1.uiscale - y_offset = -100 if ui_scale is UIScale.SMALL else 0 - x_offset = 50 if ui_scale is UIScale.SMALL else 0 + y_offset = -95 if ui_scale is UIScale.SMALL else -35 if ui_scale is UIScale.MEDIUM else 115 + x_offset = 140 if ui_scale is UIScale.SMALL else 80 if ui_scale is UIScale.MEDIUM else 240 self.old__init__(sessiontype, transition, origin_widget) # pylint: disable=protected-access @@ -142,8 +144,8 @@ def patched__init__( parent=self._root_widget, position=(width - 120 * 2 + x_offset, height - 132 + y_offset), autoselect=True, - size=(80, 60), - scale=1.1, + size=(80, 50), + scale=0.6 if ui_scale is UIScale.SMALL else 1.15, text_scale=1.2, label="Random", on_activate_call=game_starter_factory(sessiontype), diff --git a/plugins/utilities/rejoin.py b/plugins/utilities/rejoin.py index 432ed59..e78c98c 100644 --- a/plugins/utilities/rejoin.py +++ b/plugins/utilities/rejoin.py @@ -1,8 +1,8 @@ -# ba_meta require api 8 +# ba_meta require api 9 import bascenev1 as bs from babase import Plugin as v from bauiv1 import buttonwidget as z, gettexture as x -from bauiv1lib.mainmenu import MainMenuWindow as m +from bauiv1lib.ingamemenu import InGameMenuWindow as m m.i = m.p = 0 k = bs.connect_to_party @@ -10,12 +10,13 @@ k = bs.connect_to_party def j(address, port=43210, print_progress=False): try: - bs.disconnect_from_host() + if bs.get_connection_to_host_info() is not None: + bs.disconnect_from_host() + m.i = address + m.p = port + k(m.i, m.p, print_progress) except: pass - m.i = address - m.p = port - k(m.i, m.p, print_progress) def R(s): diff --git a/plugins/utilities/share_replay.py b/plugins/utilities/share_replay.py index 424a912..c0d214f 100644 --- a/plugins/utilities/share_replay.py +++ b/plugins/utilities/share_replay.py @@ -13,7 +13,7 @@ Message me in discord if you find some bug Use this code for your experiments or plugin but please dont rename this plugin and distribute with your name,don't do that,its bad' """ -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING, cast if TYPE_CHECKING: diff --git a/plugins/utilities/sorry.py b/plugins/utilities/sorry.py index fef0fe6..9c91cf4 100644 --- a/plugins/utilities/sorry.py +++ b/plugins/utilities/sorry.py @@ -59,7 +59,7 @@ class SorryPW(bauiv1lib.party.PartyWindow): for i in range(10, s._delay+1): bs.apptimer((i-10)/10, bs.Call(s._ok, i)) -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export plugin diff --git a/plugins/utilities/store_event_specials.py b/plugins/utilities/store_event_specials.py index 1e3f7ad..77cfe07 100644 --- a/plugins/utilities/store_event_specials.py +++ b/plugins/utilities/store_event_specials.py @@ -21,7 +21,7 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to """ -# ba_meta require api 8 +# ba_meta require api 9 from typing import List, Dict, Any diff --git a/plugins/utilities/tag.py b/plugins/utilities/tag.py index 24139ae..82ba52e 100644 --- a/plugins/utilities/tag.py +++ b/plugins/utilities/tag.py @@ -1,5 +1,3 @@ -# Ported by brostos to api 8 -# Tool used to make porting easier.(https://github.com/bombsquad-community/baport) """ I apreciate any kind of modification. So feel free to use or edit code or change credit string.... no problem. @@ -16,10 +14,8 @@ how to use: from __future__ import annotations from bauiv1lib.profile.edit import EditProfileWindow -from bauiv1lib.colorpicker import ColorPicker from bauiv1lib.popup import PopupMenu from bascenev1lib.actor.playerspaz import PlayerSpaz -from baenv import TARGET_BALLISTICA_BUILD as build_number import babase import bauiv1 as bui import bascenev1 as bs @@ -95,7 +91,7 @@ def gethostname() -> str: if player.inputdevice.client_id == -1: name = player.getname(full=True, icon=False) break - if name == bui.app.plus.get_v1_account_name: + if name == bui.app.plus.get_v1_account_name(): return '__account__' return name @@ -113,7 +109,11 @@ def NewPlayerSzapInit(self, highlight: Sequence[float] = (0.5, 0.5, 0.5), character: str = 'Spaz', powerups_expire: bool = True) -> None: - self.init(player, color, highlight, character, powerups_expire) + self.init(player, + color=color, + highlight=highlight, + character=character, + powerups_expire=powerups_expire) self.curname = gethostname() try: @@ -153,14 +153,13 @@ def NewPlayerSzapInit(self, def NewEditProfileWindowInit(self, existing_profile: Optional[str], - in_main_menu: bool, - transition: str = 'in_right') -> None: + transition: str = 'in_right', + origin_widget: bui.Widget | None = None) -> None: """ New boilerplate for editprofilewindow, addeds button to call TagSettings window """ self.existing_profile = existing_profile - self.in_main_menu = in_main_menu - self.init(existing_profile, in_main_menu, transition) + self.init(existing_profile, transition, origin_widget) v = self._height - 115.0 x_inset = self._x_inset @@ -183,16 +182,22 @@ def _on_tagwinbtn_press(self): """ Calls tag config window passes all paramisters """ - bui.containerwidget(edit=self._root_widget, transition='out_scale') - bui.app.ui_v1.set_main_menu_window( - TagWindow(self.existing_profile, - self.in_main_menu, - self._name, - transition='in_right').get_root_widget(), from_window=self._root_widget) + if not self.main_window_has_control(): + return + self.main_window_replace( + TagWindow( + self.existing_profile, + self._name, + transition='in_right', + origin_widget=self.tagwinbtn + ) + ) -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export plugin + + class Tag(babase.Plugin): def __init__(self) -> None: """ @@ -211,15 +216,14 @@ class Tag(babase.Plugin): EditProfileWindow.__init__ = NewEditProfileWindowInit -class TagWindow(bui.Window): +class TagWindow(bui.MainWindow): def __init__(self, existing_profile: Optional[str], - in_main_menu: bool, profilename: str, - transition: Optional[str] = 'in_right'): + transition: Optional[str] = 'in_right', + origin_widget: bui.Widget | None = None): self.existing_profile = existing_profile - self.in_main_menu = in_main_menu self.profilename = profilename uiscale = bui.app.ui_v1.uiscale @@ -233,9 +237,11 @@ class TagWindow(bui.Window): super().__init__( root_widget=bui.containerwidget( size=(self._width, self._height), - transition=transition, scale=(2.06 if uiscale is babase.UIScale.SMALL else - 1.4 if uiscale is babase.UIScale.MEDIUM else 1.0))) + 1.4 if uiscale is babase.UIScale.MEDIUM else 1.0) + ), + transition=transition, + origin_widget=origin_widget) self._back_button = bui.buttonwidget( parent=self._root_widget, @@ -246,7 +252,7 @@ class TagWindow(bui.Window): scale=0.8, label=babase.charstr(babase.SpecialChar.BACK), button_type='backSmall', - on_activate_call=self._back) + on_activate_call=self.main_window_back) bui.containerwidget(edit=self._root_widget, cancel_button=self._back_button) self._save_button = bui.buttonwidget( @@ -419,17 +425,6 @@ class TagWindow(bui.Window): increment=0.1, textscale=1.25) - def _back(self) -> None: - """ - transit window into back window - """ - bui.containerwidget(edit=self._root_widget, - transition='out_scale') - bui.app.ui_v1.set_main_menu_window(EditProfileWindow( - self.existing_profile, - self.in_main_menu, - transition='in_left').get_root_widget(), from_window=self._root_widget) - def change_val(self, config: List[str], val: bool) -> None: """ chamges the value of check boxes @@ -465,12 +460,7 @@ class TagWindow(bui.Window): bui.screenmessage(f"please define tag", color=(1, 0, 0)) bui.getsound('error').play() - bui.containerwidget(edit=self._root_widget, - transition='out_scale') - bui.app.ui_v1.set_main_menu_window(EditProfileWindow( - self.existing_profile, - self.in_main_menu, - transition='in_left').get_root_widget(), from_window=self._root_widget) + self.main_window_back() class CustomConfigNumberEdit: diff --git a/plugins/utilities/tnt_respawn_text.py b/plugins/utilities/tnt_respawn_text.py index a15fab5..67f79be 100644 --- a/plugins/utilities/tnt_respawn_text.py +++ b/plugins/utilities/tnt_respawn_text.py @@ -1,5 +1,5 @@ # Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport) -# ba_meta require api 8 +# ba_meta require api 9 """ TNT Respawn Text by TheMikirog diff --git a/plugins/utilities/topmsg.py b/plugins/utilities/topmsg.py index 263083b..21eddd9 100644 --- a/plugins/utilities/topmsg.py +++ b/plugins/utilities/topmsg.py @@ -2,7 +2,7 @@ from babase import app, Plugin as p from bascenev1 import gettexture as x, apptimer as z from bascenev1 import broadcastmessage as push, get_foreground_host_activity as ga, get_chat_messages as gcm -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export plugin @@ -22,4 +22,4 @@ class byBordd(p): s.ear() -z(0.2, byBordd().get) +z(1.0, byBordd().get) diff --git a/plugins/utilities/translate.py b/plugins/utilities/translate.py index a304daa..46c7a35 100644 --- a/plugins/utilities/translate.py +++ b/plugins/utilities/translate.py @@ -246,7 +246,7 @@ class TranslateWindow: bui.getsound('swish').play() -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export plugin class byFreaku(babase.Plugin): def __init__(self): diff --git a/plugins/utilities/unlock_TowerD.py b/plugins/utilities/unlock_TowerD.py index 172e8c0..9406d0a 100644 --- a/plugins/utilities/unlock_TowerD.py +++ b/plugins/utilities/unlock_TowerD.py @@ -12,7 +12,7 @@ def new_play_types(cls): return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill'] -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export plugin class byFreaku(babase.Plugin): def on_app_running(self): diff --git a/plugins/utilities/updown.py b/plugins/utilities/updown.py index f5ecc53..0e91483 100644 --- a/plugins/utilities/updown.py +++ b/plugins/utilities/updown.py @@ -1,7 +1,6 @@ import babase as ba import bauiv1 as bui import bauiv1lib.party -from bauiv1lib.popup import PopupWindow from bascenev1 import get_chat_messages as gcm, screenmessage as push @@ -11,6 +10,7 @@ class VeryPW(bauiv1lib.party.PartyWindow): s._n = 0 s._o = "" s._f = True + s._chat_texts_haxx = [] for i in range(2): bui.buttonwidget( parent=s._root_widget, @@ -41,6 +41,8 @@ class VeryPW(bauiv1lib.party.PartyWindow): s._n = -1 s._c(s._o) + for msg in s._chat_texts: + msg.delete() for msg in s._chat_texts_haxx: msg.delete() for z in range(len(s._w1)): @@ -61,12 +63,12 @@ class VeryPW(bauiv1lib.party.PartyWindow): flatness=1.0) bui.textwidget(edit=txt, on_activate_call=ba.Call( - s._on_chat_press, - s._w1[z], txt)) + s._copy_msg, + s._w1[z])) s._chat_texts_haxx.append(txt) bui.containerwidget(edit=s._columnwidget, visible_child=txt) -# ba_meta require api 8 +# ba_meta require api 9 # ba_meta export plugin diff --git a/plugins/utilities/xyz_tool.py b/plugins/utilities/xyz_tool.py index c3cf567..095462f 100644 --- a/plugins/utilities/xyz_tool.py +++ b/plugins/utilities/xyz_tool.py @@ -1,6 +1,5 @@ -# Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport) # Released under the MIT License. See LICENSE for details. -# ba_meta require api 8 +# ba_meta require api 9 from __future__ import annotations from typing import TYPE_CHECKING @@ -9,12 +8,10 @@ from bascenev1lib.actor.spazfactory import SpazFactory import babase import bauiv1 as bui import bascenev1 as bs -import math import os import _babase -import shutil if TYPE_CHECKING: - pass + from typing import Sequence DECIMAL_LIMIT = 7 @@ -24,11 +21,16 @@ PlayerSpaz.supershit = PlayerSpaz.__init__ def ShitInit(self, player: bs.Player, + *, color: Sequence[float] = (1.0, 1.0, 1.0), highlight: Sequence[float] = (0.5, 0.5, 0.5), character: str = 'Spaz', powerups_expire: bool = True) -> None: - self.supershit(player, color, highlight, character, powerups_expire) + self.supershit(player, + color=color, + highlight=highlight, + character=character, + powerups_expire=powerups_expire) self.offt = bs.newnode('math', owner=self.node, attrs={ 'input1': (1.2, 1.8, -0.7), 'operation': 'add'}) self.node.connectattr('torso_position', self.offt, 'input2') diff --git a/test/get_latest.py b/test/get_latest.py index 0439068..3dde5db 100644 --- a/test/get_latest.py +++ b/test/get_latest.py @@ -1,7 +1,8 @@ import json +import sys -def get_latest(): +def get_latest_version(): """Get latest version entry from index.json""" with open('index.json', 'r') as file: content = json.loads(file.read()) @@ -9,5 +10,16 @@ def get_latest(): return latest_version +def get_latest_api(): + """Get latest api entry from index.json""" + with open('index.json', 'r') as file: + content = json.loads(file.read()) + latest_api = content["versions"][get_latest_version()]["api_version"] + return latest_api + + if __name__ == "__main__": - print(get_latest()) + if len(sys.argv) < 2: + print(f"Usage: python3 {__file__.split('/')[-1]} function") + sys.exit(1) + print(globals()[sys.argv[1]]()) # used to call the fucntion passed as cli parameter diff --git a/test/version_is_lower.py b/test/version_is_lower.py index 6f65b52..8b6f429 100644 --- a/test/version_is_lower.py +++ b/test/version_is_lower.py @@ -1,5 +1,5 @@ import sys -from get_latest import get_latest +from get_latest import get_latest_version def semantic_to_str(semantic_version: str): @@ -16,7 +16,7 @@ def semantic_to_str(semantic_version: str): def version_is_lower(version: str): """Check if given version is lower than the latest entry in index.json""" - latest = semantic_to_str(get_latest()) + latest = semantic_to_str(get_latest_version()) version = semantic_to_str(version) if latest > version: return True