get_description as a class method

This commit is contained in:
Rikko 2023-01-18 18:54:16 +05:30
parent 23b4866435
commit e783e2bfa3

View file

@ -788,10 +788,11 @@ class PluginWindow(popup.PopupWindow):
loop = asyncio.get_event_loop()
loop.create_task(self.draw_ui())
async def draw_ui(self):
# print(ba.app.plugins.active_plugins)
def get_description(minimum_character_offset=40):
def get_description(self, minimum_character_offset=40):
"""
Splits the loong plugin description into multiple lines.
"""
string = self.plugin.info["description"]
string_length = len(string)
@ -811,6 +812,10 @@ class PluginWindow(popup.PopupWindow):
return partitioned_string
async def draw_ui(self):
# print(ba.app.plugins.active_plugins)
play_sound()
b_text_color = (0.75, 0.7, 0.8)
s = 1.1 if _uiscale is ba.UIScale.SMALL else 1.27 if ba.UIScale.MEDIUM else 1.57
@ -858,7 +863,7 @@ class PluginWindow(popup.PopupWindow):
ba.textwidget(parent=self._root_widget,
position=(width * 0.49, pos), size=(0, 0),
h_align='center', v_align='center',
text=get_description(), # self.plugin.info["description"],
text=self.get_description(),
scale=text_scale * 0.6, color=color,
maxwidth=width * 0.95)
b1_color = None