fix
This commit is contained in:
1 parent
5e5216d380
commit
1903b66206
2 files changed
+14
-16
No files matched your search
+6
-2
@@ -729,8 +729,12 @@
|
||||
color_mode: 'custom'
|
||||
line_color_focus: TEXT_COLOR
|
||||
size_hint: 1, 1
|
||||
# mode: "rectangle"
|
||||
# width: info.width - dp(26)
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: LIGHTGREY
|
||||
Line:
|
||||
points: self.x, self.y+self.height, self.x+self.width, self.y+self.height
|
||||
width: 1
|
||||
Label:
|
||||
size_hint_y: 1e-9 # takes up remaining space if info is closed
|
||||
|
||||
|
||||
@@ -66,9 +66,8 @@ class LeftButtonBehavior(ButtonBehavior): # stops buttons etc activating on rig
|
||||
|
||||
def on_press(self):
|
||||
if not self.last_touch or self.last_touch.button == "left":
|
||||
r = self.dispatch("on_left_press")
|
||||
return super().on_press()
|
||||
|
||||
self.dispatch("on_left_press")
|
||||
return super().on_press()
|
||||
|
||||
def on_left_release(self):
|
||||
pass
|
||||
@@ -356,11 +355,7 @@ class CollapsablePanel(MDBoxLayout):
|
||||
super().__init__(**kwargs)
|
||||
self.orientation = "vertical"
|
||||
self.bind(
|
||||
options=self.build_options,
|
||||
option_colors=self.build_options,
|
||||
options_height=self.build_options,
|
||||
option_active=self.build_options,
|
||||
options_spacing=self.build_options,
|
||||
options=self.build_options, option_colors=self.build_options, options_height=self.build_options, option_active=self.build_options, options_spacing=self.build_options,
|
||||
)
|
||||
self.bind(state=self.build, size_hint_y_open=self.build, height_open=self.build)
|
||||
self.build_options()
|
||||
@@ -369,11 +364,10 @@ class CollapsablePanel(MDBoxLayout):
|
||||
self.header = CollapsablePanelHeader(height=self.options_height, size_hint_y=None, spacing=self.options_spacing, padding=[1, 0, 0, 0])
|
||||
self.option_buttons = []
|
||||
option_labels = self.option_labels or [i18n._(f"tab:{opt}") for opt in self.options]
|
||||
for ix,(lbl, opt_col, active) in enumerate(zip(option_labels, self.option_colors, self.option_active)):
|
||||
button = CollapsablePanelTab(text=lbl, active_outline_color=opt_col, height=self.options_height,
|
||||
state="down" if active else "normal")
|
||||
for ix, (lbl, opt_col, active) in enumerate(zip(option_labels, self.option_colors, self.option_active)):
|
||||
button = CollapsablePanelTab(text=lbl, active_outline_color=opt_col, height=self.options_height, state="down" if active else "normal")
|
||||
self.option_buttons.append(button)
|
||||
button.bind(state = lambda *_args,_ix = ix: self.trigger_select(_ix) )
|
||||
button.bind(state=lambda *_args, _ix=ix: self.trigger_select(_ix))
|
||||
self.open_close_button = TransparentIconButton( # << / >> collapse button
|
||||
icon=self.open_close_icon(),
|
||||
icon_size=[0.5 * self.options_height, 0.5 * self.options_height],
|
||||
@@ -381,7 +375,7 @@ class CollapsablePanel(MDBoxLayout):
|
||||
size_hint_x=None,
|
||||
on_press=lambda *_args: self.set_state("toggle"),
|
||||
)
|
||||
self.bind()
|
||||
self.bind(state=lambda *_args: self.open_close_button.setter("icon")(None, self.open_close_icon()))
|
||||
self.build()
|
||||
|
||||
def build(self, *args, **kwargs):
|
||||
@@ -427,7 +421,7 @@ class CollapsablePanel(MDBoxLayout):
|
||||
|
||||
def trigger_select(self, ix):
|
||||
if ix is not None and self.option_buttons:
|
||||
self.option_active[ix] = (self.option_buttons[ix].state =='down')
|
||||
self.option_active[ix] = self.option_buttons[ix].state == "down"
|
||||
if self.state == "open":
|
||||
self.dispatch("on_option_state", {opt: btn.active for opt, btn in zip(self.options, self.option_buttons)})
|
||||
return False
|
||||
|
||||
Reference in new issue
Block a user