mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
Refactored and fixed updown
Fixed a bug where chat messages were to double because s._chat_texts stopped having the widgets for some reason so i just nuked all s._columnwidget's children.
This commit is contained in:
parent
2662e37aac
commit
8551a1e0c1
1 changed files with 52 additions and 42 deletions
|
|
@ -1,32 +1,45 @@
|
||||||
import babase as ba
|
from bauiv1lib import party
|
||||||
import bauiv1 as bui
|
from babase import (
|
||||||
import bauiv1lib.party
|
SpecialChar as sc,
|
||||||
from bascenev1 import get_chat_messages as gcm, screenmessage as push
|
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(party.PartyWindow):
|
||||||
class VeryPW(bauiv1lib.party.PartyWindow):
|
|
||||||
def __init__(s, *args, **kwargs):
|
def __init__(s, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
s._n = 0
|
s._n = 0
|
||||||
s._o = ""
|
s._o = ""
|
||||||
s._f = True
|
s._f = True
|
||||||
s._chat_texts_haxx = []
|
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
bui.buttonwidget(
|
bw(
|
||||||
parent=s._root_widget,
|
parent=s._root_widget,
|
||||||
size=(30, 30),
|
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',
|
button_type='square',
|
||||||
position=(-15, 70 - (i * 40)),
|
enable_sound=False,
|
||||||
on_activate_call=(s._d if i else s._p)
|
position=(-15,70-(i*40)),
|
||||||
|
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 _d(s): s._p(1)
|
||||||
|
|
||||||
def _p(s, i=0):
|
def _p(s, i=0):
|
||||||
|
print (s._chat_texts)
|
||||||
if s._f:
|
if s._f:
|
||||||
s._o = bui.textwidget(query=s._text_field)
|
s._o = tw(query=s._text_field)
|
||||||
s._f = False
|
s._f = False
|
||||||
s._n = -1
|
s._n = -1
|
||||||
s._n = s._n + (1 if i else -1)
|
s._n = s._n + (1 if i else -1)
|
||||||
|
|
@ -36,42 +49,39 @@ class VeryPW(bauiv1lib.party.PartyWindow):
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if not s._w1:
|
if not s._w1:
|
||||||
push("Empty chat")
|
push("Empty chat")
|
||||||
|
gs('block').play()
|
||||||
s._n = 0
|
s._n = 0
|
||||||
return
|
return
|
||||||
s._n = -1
|
s._n = -1
|
||||||
s._c(s._o)
|
s._c(s._o)
|
||||||
|
gs('deek').play()
|
||||||
|
|
||||||
for msg in s._chat_texts:
|
[z.delete() for z in s._columnwidget.get_children()]
|
||||||
msg.delete()
|
|
||||||
for msg in s._chat_texts_haxx:
|
|
||||||
msg.delete()
|
|
||||||
for z in range(len(s._w1)):
|
for z in range(len(s._w1)):
|
||||||
txt = bui.textwidget(parent=s._columnwidget,
|
txt = tw(
|
||||||
text=s._w1[z],
|
parent=s._columnwidget,
|
||||||
h_align='left',
|
text=s._w1[z],
|
||||||
v_align='center',
|
h_align='left',
|
||||||
size=(900, 13),
|
v_align='center',
|
||||||
scale=0.55,
|
size=(900, 13),
|
||||||
color=(1, 1, 1) if z != (s._n if s._n > -
|
scale=0.55,
|
||||||
1 else s._n + len(s._w1) + 1) else (0, 0.7, 0),
|
color=(1, 1, 1) if z != (s._n if s._n > -1 else s._n + len(s._w1) + 1) else (0, 0.7, 0),
|
||||||
position=(-0.6, 0),
|
position=(-0.6, 0),
|
||||||
selectable=True,
|
selectable=True,
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
click_activate=True,
|
click_activate=True,
|
||||||
maxwidth=s._scroll_width * 0.94,
|
maxwidth=s._scroll_width * 0.94,
|
||||||
shadow=0.3,
|
shadow=0.3,
|
||||||
flatness=1.0)
|
flatness=1.0
|
||||||
bui.textwidget(edit=txt,
|
)
|
||||||
on_activate_call=ba.Call(
|
tw(
|
||||||
s._copy_msg,
|
txt,
|
||||||
s._w1[z]))
|
on_activate_call=Call(s._copy_msg,s._w1[z])
|
||||||
s._chat_texts_haxx.append(txt)
|
)
|
||||||
bui.containerwidget(edit=s._columnwidget, visible_child=txt)
|
cw(edit=s._columnwidget, visible_child=txt)
|
||||||
|
|
||||||
# ba_meta require api 9
|
# ba_meta require api 9
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
class byBordd(Plugin):
|
||||||
|
|
||||||
class byBordd(ba.Plugin):
|
|
||||||
def __init__(s):
|
def __init__(s):
|
||||||
bauiv1lib.party.PartyWindow = VeryPW
|
party.PartyWindow = VeryPW
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue