Fixing Errors

This commit is contained in:
vishal332008 2022-07-18 23:14:10 +05:30
parent 5957c6cfad
commit eb16a2d3e6
2 changed files with 54 additions and 44 deletions

View file

@ -1,2 +1,2 @@
# mod-manager # plugin-manager
A Mod Manager for Bombsquad A Plugin Manager for Bombsquad

View file

@ -93,7 +93,9 @@ class PluginManagerWindow(ba.Window, PluginManager):
uiscale = ba.app.ui.uiscale uiscale = ba.app.ui.uiscale
self._width = 650 self._width = 650
self._height = 380 if uiscale is ba.UIScale.SMALL else 420 if uiscale is ba.UIScale.MEDIUM else 500 self._height = (380 if uiscale is ba.UIScale.SMALL
else 420 if uiscale is ba.UIScale.MEDIUM
else 500)
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0 top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
if origin_widget: if origin_widget:
@ -107,7 +109,9 @@ class PluginManagerWindow(ba.Window, PluginManager):
toolbar_visibility="menu_minimal", toolbar_visibility="menu_minimal",
scale_origin_stack_offset=self._scale_origin, scale_origin_stack_offset=self._scale_origin,
parent=_ba.get_special_widget("overlay_stack"), parent=_ba.get_special_widget("overlay_stack"),
scale=1.9 if uiscale is ba.UIScale.SMALL else 1.5 if uiscale is ba.UIScale.MEDIUM else 1.0, scale=(1.9 if uiscale is ba.UIScale.SMALL
else 1.5 if uiscale is ba.UIScale.MEDIUM
else 1.0),
stack_offset=(0, -25) if uiscale is ba.UIScale.SMALL else (0, 0) stack_offset=(0, -25) if uiscale is ba.UIScale.SMALL else (0, 0)
) )
@ -243,12 +247,14 @@ class PluginManagerWindow(ba.Window, PluginManager):
await self.draw_search_bar() await self.draw_search_bar()
async def draw_category_selection_button(self, label=None): async def draw_category_selection_button(self, label=None):
uiscale = ba.app.ui.uiscale # uiscale = ba.app.ui.uiscale
# v = (self._height - 75) if uiscale is ba.UIScale.SMALL else (self._height - 105) # v = (self._height - 75) if uiscale is ba.UIScale.SMALL else (self._height - 105)
v = 395 v = 395
h = 440 h = 440
# s = 1.0 if uiscale is ba.UIScale.SMALL else 1.27 if uiscale is ba.UIScale.MEDIUM else 1.57 # the next 2 lines belong in 1 line
s = 1.75 # # s = 1.0 if uiscale is ba.UIScale.SMALL else
# # 1.27 if uiscale is ba.UIScale.MEDIUM else 1.57
# s = 1.75
# b_size = (90, 60 * s) # b_size = (90, 60 * s)
b_size = (150, 30) b_size = (150, 30)
b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.75, 0.7, 0.8)
@ -261,11 +267,12 @@ class PluginManagerWindow(ba.Window, PluginManager):
if self.category_selection_button is not None: if self.category_selection_button is not None:
self.category_selection_button.delete() self.category_selection_button.delete()
loop = asyncio.get_event_loop() # loop = asyncio.get_event_loop()
self.category_selection_button = ba.buttonwidget(parent=self._root_widget, self.category_selection_button = ba.buttonwidget(parent=self._root_widget,
position=(h, v), position=(h, v),
size=b_size, size=b_size,
# on_activate_call=ba.Call(loop.create_task, self.show_categories()), # on_activate_call=ba.Call(loop.create_
# task, self.show_categories()),
on_activate_call=self.show_categories, on_activate_call=self.show_categories,
label=label, label=label,
button_type="square", button_type="square",
@ -281,7 +288,7 @@ class PluginManagerWindow(ba.Window, PluginManager):
scale=0.7, scale=0.7,
# selectable=True, # selectable=True,
always_highlight=True, always_highlight=True,
color=(0.4,0.4,0.4), color=(0.4, 0.4, 0.4),
# on_select_call=lambda: None, # on_select_call=lambda: None,
text="<Implement plugin search>", text="<Implement plugin search>",
on_activate_call=lambda: None, on_activate_call=lambda: None,
@ -289,7 +296,6 @@ class PluginManagerWindow(ba.Window, PluginManager):
v_align='center', v_align='center',
maxwidth=420) maxwidth=420)
async def draw_settings_icon(self): async def draw_settings_icon(self):
controller_button = ba.buttonwidget(parent=self._root_widget, controller_button = ba.buttonwidget(parent=self._root_widget,
autoselect=True, autoselect=True,
@ -306,15 +312,17 @@ class PluginManagerWindow(ba.Window, PluginManager):
draw_controller=controller_button) draw_controller=controller_button)
async def draw_plugin_names(self): async def draw_plugin_names(self):
uiscale = ba.app.ui.uiscale # uiscale = ba.app.ui.uiscale
v = (self._height - 75) if uiscale is ba.UIScale.SMALL else (self._height - 105) # v = (self._height - 75) if uiscale is ba.UIScale.SMALL else (self._height - 105)
h = 440 # h = 440
# s = 1.0 if uiscale is ba.UIScale.SMALL else 1.27 if uiscale is ba.UIScale.MEDIUM else 1.57 # next 2 lines belong in 1 line
s = 1.75 # # s = 1.0 if uiscale is ba.UIScale.SMALL else
# b_size = (90, 60 * s) # # 1.27 if uiscale is ba.UIScale.MEDIUM else 1.57
b_size = (150, 30) # s = 1.75
b_textcolor = (0.75, 0.7, 0.8) # # b_size = (90, 60 * s)
b_color = (0.6, 0.53, 0.63) # b_size = (150, 30)
# b_textcolor = (0.75, 0.7, 0.8)
# b_color = (0.6, 0.53, 0.63)
for plugin in self._columnwidget.get_children(): for plugin in self._columnwidget.get_children():
plugin.delete() plugin.delete()
@ -324,7 +332,7 @@ class PluginManagerWindow(ba.Window, PluginManager):
ba.textwidget(parent=self._columnwidget, ba.textwidget(parent=self._columnwidget,
size=(410, 30), size=(410, 30),
selectable=True, always_highlight=True, selectable=True, always_highlight=True,
color=(1,1,1), color=(1, 1, 1),
on_select_call=lambda: None, on_select_call=lambda: None,
text=plugin, text=plugin,
on_activate_call=lambda: None, on_activate_call=lambda: None,
@ -334,7 +342,8 @@ class PluginManagerWindow(ba.Window, PluginManager):
def show_categories(self): def show_categories(self):
uiscale = ba.app.ui.uiscale uiscale = ba.app.ui.uiscale
# On each new entry, change position to y -= 40. # On each new entry, change position to y -= 40.
value = bastd.ui.popup.PopupMenuWindow( # value = bastd.ui.popup.PopupMenuWindow(
bastd.ui.popup.PopupMenuWindow(
# position=(200, 40), # position=(200, 40),
position=(200, 0), position=(200, 0),
scale=(2.3 if uiscale is ba.UIScale.SMALL else scale=(2.3 if uiscale is ba.UIScale.SMALL else
@ -500,8 +509,9 @@ class NewAllSettingsWindow(ba.Window):
on_activate_call=self._do_audio) on_activate_call=self._do_audio)
_b_title(x_offs4, v, abtn, ba.Lstr(resource=self._r + ".audioText")) _b_title(x_offs4, v, abtn, ba.Lstr(resource=self._r + ".audioText"))
imgw = imgh = 120 imgw = imgh = 120
ba.imagewidget(parent=self._root_widget, position=( ba.imagewidget(parent=self._root_widget,
x_offs4 + basew * 0.49 - imgw * 0.5 + 5, v + 35), size=(imgw, imgh), position=(x_offs4 + basew * 0.49 - imgw * 0.5 + 5, v + 35),
size=(imgw, imgh),
color=(1, 1, 0), texture=ba.gettexture("audioIcon"), color=(1, 1, 0), texture=ba.gettexture("audioIcon"),
draw_controller=abtn) draw_controller=abtn)
v -= (baseh - 5) v -= (baseh - 5)
@ -546,11 +556,11 @@ class NewAllSettingsWindow(ba.Window):
@staticmethod @staticmethod
def _preload_modules() -> None: def _preload_modules() -> None:
"""Preload modules we use (called in bg thread).""" """Preload modules we use (called in bg thread)."""
import bastd.ui.mainmenu as _unused1 # import bastd.ui.mainmenu as _unused1
import bastd.ui.settings.controls as _unused2 # import bastd.ui.settings.controls as _unused2
import bastd.ui.settings.graphics as _unused3 # import bastd.ui.settings.graphics as _unused3
import bastd.ui.settings.audio as _unused4 # import bastd.ui.settings.audio as _unused4
import bastd.ui.settings.advanced as _unused5 # import bastd.ui.settings.advanced as _unused5
def _do_back(self) -> None: def _do_back(self) -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
@ -652,7 +662,7 @@ class EntryPoint(ba.Plugin):
from bastd.ui.settings import allsettings from bastd.ui.settings import allsettings
allsettings.AllSettingsWindow = NewAllSettingsWindow allsettings.AllSettingsWindow = NewAllSettingsWindow
asyncio.set_event_loop(ba._asyncio._asyncio_event_loop) asyncio.set_event_loop(ba._asyncio._asyncio_event_loop)
loop = asyncio.get_event_loop() # loop = asyncio.get_event_loop()
# loop.create_task(do()) # loop.create_task(do())
# pm = PluginManager() # pm = PluginManager()
# pm.plugin_index() # pm.plugin_index()