Merge pull request #360 from BroBordd/main

Many fixes
This commit is contained in:
Loup 2025-04-08 22:18:44 +05:30 committed by GitHub
commit 2fe40c15d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 241 additions and 164 deletions

View file

@ -1,5 +1,9 @@
## Plugin Manager (dd-mm-yyyy)
### 1.1.2 (06-04-2025)
- Small UI fixes.
### 1.1.1 (09-02-2025)
- Added bomb spinner widget for loading animation.

View file

@ -1,6 +1,12 @@
{
"plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py",
"versions": {
"1.1.2": {
"api_version": 9,
"commit_sha": "8f484fc",
"released_on": "08-04-2025",
"md5sum": "a6dd38d92c6c850cd1bab866870e48b5"
},
"1.1.1": {
"api_version": 9,
"commit_sha": "93106f2",

View file

@ -29,7 +29,7 @@ from datetime import datetime
# Modules used for overriding AllSettingsWindow
import logging
PLUGIN_MANAGER_VERSION = "1.1.1"
PLUGIN_MANAGER_VERSION = "1.1.2"
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.
@ -850,12 +850,13 @@ class ChangelogWindow(popup.PopupWindow):
self._transition_out = 'out_scale'
transition = 'in_scale'
self._root_widget = bui.containerwidget(size=(width, height),
self._root_widget = bui.containerwidget(
size=(width, height),
on_outside_click_call=self._back,
transition=transition,
scale=(1.5 if _uiscale is babase.UIScale.SMALL else 1.5
if _uiscale is babase.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=self.scale_origin)
scale=(1.5 if _uiscale is babase.UIScale.SMALL else 1.5 if _uiscale is babase.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=self.scale_origin
)
bui.textwidget(parent=self._root_widget,
position=(width * 0.49, height * 0.87), size=(0, 0),
@ -928,12 +929,14 @@ class AuthorsWindow(popup.PopupWindow):
self._transition_out = 'out_scale'
transition = 'in_scale'
self._root_widget = bui.containerwidget(size=(width, height),
self._root_widget = bui.containerwidget(
size=(width, height),
on_outside_click_call=self._back,
transition=transition,
scale=(1.5 if _uiscale is babase.UIScale.SMALL else 1.5
if _uiscale is babase.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=self.scale_origin)
scale_origin_stack_offset=self.scale_origin
)
pos = height * 0.9
bui.textwidget(parent=self._root_widget,
@ -1030,12 +1033,14 @@ class PluginWindow(popup.PopupWindow):
self._transition_out = 'out_scale'
transition = 'in_scale'
self._root_widget = bui.containerwidget(size=(width, height),
self._root_widget = bui.containerwidget(
size=(width, height),
on_outside_click_call=self._cancel,
transition=transition,
scale=(2.1 if _uiscale is babase.UIScale.SMALL else 1.5
if _uiscale is babase.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=self.scale_origin)
scale_origin_stack_offset=self.scale_origin
)
pos = height * 0.8
plug_name = self.plugin.name.replace('_', ' ').title()
@ -1146,9 +1151,11 @@ class PluginWindow(popup.PopupWindow):
text_scale=1,
label=button3_label)
bui.containerwidget(edit=self._root_widget,
bui.containerwidget(
edit=self._root_widget,
on_cancel_call=self._cancel,
selected_child=selected_btn)
selected_child=selected_btn
)
open_pos_x = (390 if _uiscale is babase.UIScale.SMALL else
450 if _uiscale is babase.UIScale.MEDIUM else 440)
@ -1474,13 +1481,15 @@ class PluginSourcesWindow(popup.PopupWindow):
b_textcolor = (0.75, 0.7, 0.8)
self._transition_out = 'out_scale'
transition = 'in_scale'
self._root_widget = bui.containerwidget(size=(400, 340),
self._root_widget = bui.containerwidget(
size=(400, 340),
on_outside_click_call=self._ok,
transition=transition,
scale=(2.1 if _uiscale is babase.UIScale.SMALL else 1.5
if _uiscale is babase.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=self.scale_origin,
on_cancel_call=self._ok)
on_cancel_call=self._ok
)
bui.textwidget(
parent=self._root_widget,
@ -1637,7 +1646,7 @@ class PluginCategoryWindow(popup.PopupMenuWindow):
self._asyncio_callback = asyncio_callback
self.scale_origin = origin_widget.get_screen_space_center()
super().__init__(
position=(200, 0),
position=self.scale_origin,
scale=(2.3 if _uiscale is babase.UIScale.SMALL else
1.65 if _uiscale is babase.UIScale.MEDIUM else 1.23),
choices=choices,
@ -1667,7 +1676,7 @@ class PluginCategoryWindow(popup.PopupMenuWindow):
class PluginManagerWindow(bui.MainWindow):
def __init__(self, transition: str = "in_right", origin_widget: bui.Widget = None):
def __init__(self, transition: str = "in_right", origin_widget: bui.widget = None):
self.plugin_manager = PluginManager()
self.category_selection_button = None
self.selected_category = 'All'
@ -1760,12 +1769,18 @@ class PluginManagerWindow(bui.MainWindow):
size=48,
)
def spin(self, show=False):
w = self._loading_spinner
p = self._root_widget
bui.spinnerwidget(w, visible=show) if w.exists(
) and p.exists() and not p.transitioning_out else None
@contextlib.contextmanager
def exception_handler(self):
try:
yield
except urllib.error.URLError:
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
self.spin()
try:
bui.textwidget(
edit=self._plugin_manager_status_text,
@ -1778,7 +1793,7 @@ class PluginManagerWindow(bui.MainWindow):
# User probably went back before a bui.Window could finish loading.
pass
except Exception as e:
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
self.spin()
try:
bui.textwidget(edit=self._plugin_manager_status_text, text=str(e))
except:
@ -1794,7 +1809,7 @@ class PluginManagerWindow(bui.MainWindow):
with self.exception_handler():
await self.plugin_manager.setup_changelog()
await self.plugin_manager.setup_index()
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
self.spin()
try:
bui.textwidget(edit=self._plugin_manager_status_text, text="")
except:
@ -1840,26 +1855,30 @@ class PluginManagerWindow(bui.MainWindow):
textcolor=b_textcolor,
text_scale=0.6)
else:
bui.buttonwidget(edit=self.alphabet_order_selection_button,
b = self.alphabet_order_selection_button
bui.buttonwidget(
edit=b,
label=('Z - A' if self.selected_alphabet_order == 'z_a' else 'A - Z')
)
) if b.exists() else None
label = f"Category: {post_label}"
if self.category_selection_button is None:
self.category_selection_button = bui.buttonwidget(parent=self._root_widget,
self.category_selection_button = b = bui.buttonwidget(parent=self._root_widget,
position=(category_pos_x,
category_pos_y),
size=b_size,
on_activate_call=(
self.show_categories_window),
label=label,
button_type="square",
textcolor=b_textcolor,
text_scale=0.6)
bui.buttonwidget(b, on_activate_call=lambda: self.show_categories_window(source=b)),
else:
self.category_selection_button = bui.buttonwidget(edit=self.category_selection_button,
label=label)
b = self.category_selection_button
bui.buttonwidget(
edit=b,
label=label
) if b.exists() else None
async def _on_order_button_press(self) -> None:
self.selected_alphabet_order = ('a_z' if self.selected_alphabet_order == 'z_a' else 'z_a')
@ -1944,10 +1963,15 @@ class PluginManagerWindow(bui.MainWindow):
position=(settings_pos_x, settings_pos_y),
size=(30, 30),
button_type="square",
label="",
on_activate_call=babase.Call(PluginManagerSettingsWindow,
label="")
bui.buttonwidget(
controller_button,
on_activate_call=babase.Call(
PluginManagerSettingsWindow,
self.plugin_manager,
self._root_widget))
controller_button
)
)
bui.imagewidget(parent=self._root_widget,
position=(settings_pos_x, settings_pos_y),
size=(30, 30),
@ -1961,19 +1985,22 @@ class PluginManagerWindow(bui.MainWindow):
refresh_pos_y = (180 if _uiscale is babase.UIScale.SMALL else
108 if _uiscale is babase.UIScale.MEDIUM else 120)
controller_button = bui.buttonwidget(parent=self._root_widget,
controller_button = bui.buttonwidget(
parent=self._root_widget,
position=(refresh_pos_x, refresh_pos_y),
size=(30, 30),
button_type="square",
label="",
on_activate_call=lambda:
loop.create_task(self.refresh()))
bui.imagewidget(parent=self._root_widget,
on_activate_call=lambda: loop.create_task(self.refresh())
)
bui.imagewidget(
parent=self._root_widget,
position=(refresh_pos_x, refresh_pos_y),
size=(30, 30),
color=(0.8, 0.95, 1),
texture=bui.gettexture("replayIcon"),
draw_controller=controller_button)
draw_controller=controller_button
)
def search_term_filterer(self, plugin, search_term):
# This helps resolve "plugin name" to "plugin_name".
@ -2029,17 +2056,19 @@ class PluginManagerWindow(bui.MainWindow):
self._last_filter_text = search_term
self._last_filter_plugins = plugins
if not self._columnwidget.exists():
return
if category == 'Installed':
plugin_names_to_draw = tuple(self.draw_plugin_name(plugin)
for plugin in plugins if plugin.is_installed)
plugin_names_to_draw = tuple(
self.draw_plugin_name(plugin) for plugin in plugins if plugin.is_installed
)
else:
plugin_names_to_draw = tuple(self.draw_plugin_name(plugin) for plugin in plugins)
for plugin in self._columnwidget.get_children():
plugin.delete()
[plugin.delete() for plugin in self._columnwidget.get_children()]
text_widget = bui.textwidget(parent=self._columnwidget)
text_widget.delete()
await asyncio.gather(*plugin_names_to_draw)
async def draw_plugin_name(self, plugin):
@ -2065,10 +2094,13 @@ class PluginManagerWindow(bui.MainWindow):
plugin_name_widget_to_update = self.plugins_in_current_view.get(plugin.name)
if plugin_name_widget_to_update:
bui.textwidget(edit=plugin_name_widget_to_update,
color=color)
bui.textwidget(
edit=plugin_name_widget_to_update,
color=color
)
else:
text_widget = bui.textwidget(parent=self._columnwidget,
text_widget = bui.textwidget(
parent=self._columnwidget,
size=(410, 30),
selectable=True,
always_highlight=True,
@ -2078,7 +2110,8 @@ class PluginManagerWindow(bui.MainWindow):
on_activate_call=lambda: self.show_plugin_window(plugin),
h_align='left',
v_align='center',
maxwidth=420)
maxwidth=420
)
self.plugins_in_current_view[plugin.name] = text_widget
# XXX: This seems nicer. Might wanna use this in future.
# text_widget.add_delete_callback(lambda: self.plugins_in_current_view.pop(plugin.name))
@ -2086,11 +2119,11 @@ class PluginManagerWindow(bui.MainWindow):
def show_plugin_window(self, plugin):
PluginWindow(plugin, self._root_widget, lambda: self.draw_plugin_name(plugin))
def show_categories_window(self):
def show_categories_window(self, source):
PluginCategoryWindow(
self.plugin_manager.categories.keys(),
self.selected_category,
self._root_widget,
source,
self.select_category,
)
@ -2116,13 +2149,13 @@ class PluginManagerWindow(bui.MainWindow):
# except:
# pass
bui.spinnerwidget(edit=self._loading_spinner, visible=True)
self.spin(True)
with self.exception_handler():
await self.plugin_manager.refresh()
await self.plugin_manager.setup_changelog()
await self.plugin_manager.setup_index()
bui.spinnerwidget(edit=self._loading_spinner, visible=False)
self.spin()
try:
bui.textwidget(edit=self._plugin_manager_status_text, text="")
except:
@ -2158,15 +2191,18 @@ class PluginManagerSettingsWindow(popup.PopupWindow):
transition = 'in_scale'
button_size = (32 * s, 32 * s)
# index = await self._plugin_manager.get_index()
self._root_widget = bui.containerwidget(size=(width, height),
self._root_widget = bui.containerwidget(
size=(width, height),
on_outside_click_call=self._ok,
transition=transition,
scale=(2.1 if _uiscale is babase.UIScale.SMALL else 1.5
if _uiscale is babase.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=self.scale_origin)
scale_origin_stack_offset=self.scale_origin
)
pos = height * 0.9
setting_title = "Settings"
bui.textwidget(parent=self._root_widget,
bui.textwidget(
parent=self._root_widget,
position=(width * 0.49, pos),
size=(0, 0),
h_align='center',
@ -2174,18 +2210,18 @@ class PluginManagerSettingsWindow(popup.PopupWindow):
text=setting_title,
scale=text_scale,
color=bui.app.ui_v1.title_color,
maxwidth=width * 0.9)
maxwidth=width * 0.9
)
pos -= 20
self._changelog_button = bui.buttonwidget(parent=self._root_widget,
self._changelog_button = b = bui.buttonwidget(parent=self._root_widget,
position=((width * 0.2) - button_size[0] / 2 - 5,
pos),
size=(80, 30),
on_activate_call=lambda:
ChangelogWindow(self._root_widget),
textcolor=b_text_color,
button_type='square',
label='')
bui.buttonwidget(b, on_activate_call=lambda: ChangelogWindow(b))
bui.textwidget(parent=self._root_widget,
position=((width * 0.2) - button_size[0] / 2, pos),
size=(70, 30),
@ -2369,7 +2405,7 @@ class NewAllSettingsWindow(AllSettingsWindow):
def __init__(
self,
transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None,
origin_widget: bui.widget | None = None,
):
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
@ -2445,7 +2481,7 @@ class NewAllSettingsWindow(AllSettingsWindow):
x_offs4 -= x_dif
def _b_title(
x: float, y: float, button: bui.Widget, text: str | bui.Lstr
x: float, y: float, button: bui.widget, text: str | bui.Lstr
) -> None:
bui.textwidget(
parent=self._root_widget,
@ -2604,7 +2640,7 @@ class NewAllSettingsWindow(AllSettingsWindow):
sel_name = bui.app.ui_v1.window_states.get(type(self), {}).get(
'sel_name'
)
sel: bui.Widget | None
sel: bui.widget | None
if sel_name == 'Controllers':
sel = self._controllers_button
elif sel_name == 'Graphics':

View file

@ -58,6 +58,12 @@
}
],
"versions": {
"1.2.1": {
"api_version": 9,
"commit_sha": "f1917f7",
"released_on": "08-04-2025",
"md5sum": "e523a7a40024c01e6a7595836237ee8b"
},
"1.2.0": {
"api_version": 8,
"commit_sha": "3a62e48",
@ -77,6 +83,12 @@
}
],
"versions": {
"1.1.1": {
"api_version": 9,
"commit_sha": "f1917f7",
"released_on": "08-04-2025",
"md5sum": "45925247145c0126f73f895932202822"
},
"1.1.0": {
"api_version": 9,
"commit_sha": "90cbaf7",
@ -753,6 +765,12 @@
}
],
"versions": {
"2.1.3": {
"api_version": 9,
"commit_sha": "0defd84",
"released_on": "05-04-2025",
"md5sum": "9d58abc6e5b9e6779e59a2e2f35f8a3d"
},
"2.1.2": {
"api_version": 9,
"commit_sha": "c912759",

View file

@ -78,9 +78,8 @@ def newconnect_to_party(address, port=43210, print_progress=False):
global p_port
bs.chatmessage(" Joined IP "+ip_add+" PORT "+str(p_port))
dd = bs.get_connection_to_host_info_2()
if dd != None and dd.get('name', '') != '':
title = dd['name']
bs.chatmessage(title)
title = getattr(dd, 'name', '')
bs.chatmessage(title) if dd and title else None
if (bool(dd)):
bs.disconnect_from_host()

View file

@ -1,6 +1,6 @@
import babase as ba
import _babase as _ba # music control
import bauiv1lib.mainmenu as mm
from bauiv1lib.ingamemenu import InGameMenuWindow as igm
import bauiv1 as bui
import bascenev1 as bs
from bascenev1 import broadcastmessage as push, get_foreground_host_activity as ga
@ -48,7 +48,7 @@ def var(s, v=None):
cfg.commit()
class Nice(mm.MainMenuWindow):
class Nice(igm):
# config, trash code ik
def_attrs = [False, "Spaz", 2.0, 0.0, 1.0, 0.4, (1, 1, 1), 3, "normal", False, False,
(1, 1, 1), 0.5, False, 0.0, False, False, 9.0, 5.0, 1.0, 0.7, True, False,
@ -2415,7 +2415,7 @@ class Nice(mm.MainMenuWindow):
if self.sbox.exists():
bui.buttonwidget(edit=self.sbox, icon=bui.gettexture('chestIcon'))
def wrap(self=mm.MainMenuWindow._refresh_in_game, *args, **kwargs):
def wrap(self=igm._refresh_in_game, *args, **kwargs):
r = s(self, *args, **kwargs)
h = 125
v = self._height - 60.0
@ -3108,7 +3108,7 @@ class Nice(mm.MainMenuWindow):
bui.textwidget(edit=preview_text4, text=currently_txt)
s.hl2(lmao_bots[currently_dux].node, True)
# start colntrol from here
# start control from here
i.assigninput(ba.InputType.UP_DOWN, bs.Call(s.set_x))
i.assigninput(ba.InputType.LEFT_RIGHT, bs.Call(s.set_y))
i.assigninput(ba.InputType.PICK_UP_PRESS, bs.Call(s.key, 0))
@ -3983,7 +3983,7 @@ class Nice(mm.MainMenuWindow):
s.preview(i, (bot.node.hurt < 1), 1)
def listen_window(s):
global listen_widget, music_preview_image, music_preview_text, music_preview_text2, music_dux
global listen_widget, music_preview_image, wmusic_preview_text, music_preview_text2, music_dux
music_dux = 8
listen_widget = bui.containerwidget(parent=bui.get_special_widget('overlay_stack'),
size=(500, 300),
@ -5925,7 +5925,7 @@ class CustomBotSet(SpazBotSet):
except:
pass
# ba_meta require api 8
# ba_meta require api 9
# BroBordd touch grass
# Copyright 2024, solely by BroBordd. All rights reserved.
# ba_meta export plugin
@ -5933,7 +5933,7 @@ class CustomBotSet(SpazBotSet):
class byBordd(ba.Plugin):
def __init__(s):
mm.MainMenuWindow._refresh_in_game = Nice.Button(mm.MainMenuWindow._refresh_in_game)
igm._refresh_in_game = Nice.Button(igm._refresh_in_game)
# All Textures (generated)

View file

@ -1,32 +1,46 @@
import babase as ba
import bauiv1 as bui
import bauiv1lib.party
from bascenev1 import get_chat_messages as gcm, screenmessage as push
from bauiv1lib import party
from babase import (
SpecialChar as sc,
charstr as cs,
Plugin,
Call
)
from bauiv1 import (
containerwidget as cw,
buttonwidget as bw,
textwidget as tw,
getsound as gs
)
from bascenev1 import (
get_chat_messages as gcm,
screenmessage as push
)
class VeryPW(bauiv1lib.party.PartyWindow):
class VeryPW(party.PartyWindow):
def __init__(s, *args, **kwargs):
super().__init__(*args, **kwargs)
s._n = 0
s._o = ""
s._f = True
s._chat_texts_haxx = []
for i in range(2):
bui.buttonwidget(
bw(
parent=s._root_widget,
size=(30, 30),
label=ba.charstr(ba.SpecialChar.DOWN_ARROW if i else ba.SpecialChar.UP_ARROW),
label=cs(getattr(sc, f"{['UP', 'DOWN'][i]}_ARROW")),
button_type='square',
enable_sound=False,
position=(-15, 70-(i*40)),
on_activate_call=(s._d if i else s._p)
on_activate_call=[s._p, s._d][i]
)
def _c(s, t=""): bui.textwidget(edit=s._text_field, text=t)
def _c(s, t=""): tw(edit=s._text_field, text=t)
def _d(s): s._p(1)
def _p(s, i=0):
print(s._chat_texts)
if s._f:
s._o = bui.textwidget(query=s._text_field)
s._o = tw(query=s._text_field)
s._f = False
s._n = -1
s._n = s._n + (1 if i else -1)
@ -36,17 +50,17 @@ class VeryPW(bauiv1lib.party.PartyWindow):
except IndexError:
if not s._w1:
push("Empty chat")
gs('block').play()
s._n = 0
return
s._n = -1
s._c(s._o)
gs('deek').play()
for msg in s._chat_texts:
msg.delete()
for msg in s._chat_texts_haxx:
msg.delete()
[z.delete() for z in s._columnwidget.get_children()]
for z in range(len(s._w1)):
txt = bui.textwidget(parent=s._columnwidget,
txt = tw(
parent=s._columnwidget,
text=s._w1[z],
h_align='left',
v_align='center',
@ -60,18 +74,18 @@ class VeryPW(bauiv1lib.party.PartyWindow):
click_activate=True,
maxwidth=s._scroll_width * 0.94,
shadow=0.3,
flatness=1.0)
bui.textwidget(edit=txt,
on_activate_call=ba.Call(
s._copy_msg,
s._w1[z]))
s._chat_texts_haxx.append(txt)
bui.containerwidget(edit=s._columnwidget, visible_child=txt)
flatness=1.0
)
tw(
txt,
on_activate_call=Call(s._copy_msg, s._w1[z])
)
cw(edit=s._columnwidget, visible_child=txt)
# ba_meta require api 9
# ba_meta export plugin
class byBordd(ba.Plugin):
class byBordd(Plugin):
def __init__(s):
bauiv1lib.party.PartyWindow = VeryPW
party.PartyWindow = VeryPW