Merge pull request #1 from Loup-Garou911XD/main

Now drawing a controller for text
This commit is contained in:
Vishal 2024-04-21 18:37:10 +05:30 committed by GitHub
commit 27d1a1edef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 29 deletions

View file

@ -3,9 +3,9 @@
"versions": {
"1.0.14": {
"api_version": 8,
"commit_sha": "0090a02",
"commit_sha": "fc5a7f1",
"released_on": "21-04-2024",
"md5sum": "c152f1e515c1a43445038694599de2f3"
"md5sum": "d25f8b80387d532d1d8aa3b84b35b696"
},
"1.0.13": {
"api_version": 8,

View file

@ -1030,6 +1030,13 @@ class PluginWindow(popup.PopupWindow):
pos -= 25
# Author
text = 'by ' + ', '.join([author["name"] for author in self.plugin.info["authors"]])
author_text_control_btn = bui.buttonwidget(parent=self._root_widget,
position=(width * 0.49 -
(len(text)*14/2), pos - 10),
size=(len(text)*14, 20),
label='',
texture=bui.gettexture("empty"),
on_activate_call=lambda: AuthorsWindow(self.plugin.info["authors"], self._root_widget))
bui.textwidget(parent=self._root_widget,
position=(width * 0.49 - (len(text)*14/2), pos - 10),
size=(len(text)*14, 20),
@ -1037,10 +1044,10 @@ class PluginWindow(popup.PopupWindow):
v_align='center',
text=text,
scale=text_scale * 0.8,
color=color,
color=(0.45, 0.36, 0.46),
maxwidth=width * 0.9,
selectable=True,
on_activate_call=lambda: AuthorsWindow(self.plugin.info["authors"], self._root_widget))
draw_controller=author_text_control_btn,
)
pos -= 35
# status = bui.textwidget(parent=self._root_widget,
# position=(width * 0.49, pos), size=(0, 0),
@ -1088,19 +1095,19 @@ class PluginWindow(popup.PopupWindow):
button1_action = self.install
if to_draw_button1:
bui.buttonwidget(parent=self._root_widget,
position=(
width * (
0.1 if self.plugin.is_installed and has_update else
0.25 if self.plugin.is_installed else
0.4), pos),
size=button_size,
on_activate_call=button1_action,
color=b1_color,
textcolor=b_text_color,
button_type='square',
text_scale=1,
label=button1_label)
button1 = bui.buttonwidget(parent=self._root_widget,
position=(
width * (
0.1 if self.plugin.is_installed and has_update else
0.25 if self.plugin.is_installed else
0.4), pos),
size=button_size,
on_activate_call=button1_action,
color=b1_color,
textcolor=b_text_color,
button_type='square',
text_scale=1,
label=button1_label)
if self.plugin.is_installed:
bui.buttonwidget(parent=self._root_widget,
@ -1114,18 +1121,19 @@ class PluginWindow(popup.PopupWindow):
label=button2_label)
if has_update:
bui.buttonwidget(parent=self._root_widget,
position=(width * 0.7, pos),
size=button_size,
on_activate_call=button3_action,
color=b3_color,
textcolor=b_text_color,
autoselect=True,
button_type='square',
text_scale=1,
label=button3_label)
button1 = bui.buttonwidget(parent=self._root_widget,
position=(width * 0.7, pos),
size=button_size,
on_activate_call=button3_action,
color=b3_color,
textcolor=b_text_color,
autoselect=True,
button_type='square',
text_scale=1,
label=button3_label)
bui.containerwidget(edit=self._root_widget,
on_cancel_call=self._cancel)
on_cancel_call=self._cancel,
selected_child=button1)
open_pos_x = (390 if _uiscale is babase.UIScale.SMALL else
450 if _uiscale is babase.UIScale.MEDIUM else 440)