Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_actions_buttons(self, box, data):
if data:
name_action_button, function_action_button = data
action_button = MDFlatButton(
text=f"[b]{name_action_button}[/b]",
theme_text_color="Custom",
text_color=self.theme_cls.primary_color,
on_release=function_action_button,
)
action_button.markup = True
box.add_widget(action_button)
_radius = NumericProperty(dp(2))
_height = NumericProperty(dp(0))
button_label = BooleanProperty(True)
can_capitalize = BooleanProperty(True)
class MDIconButton(BaseRoundButton, BaseFlatButton, BasePressedButton):
icon = StringProperty("checkbox-blank-circle")
"""Button icon."""
class MDFlatButton(BaseRectangularButton, BaseFlatButton, BasePressedButton):
pass
class BaseFlatIconButton(MDFlatButton):
icon = StringProperty("android")
text = StringProperty("")
button_label = BooleanProperty(False)
class MDRaisedButton(
BaseRectangularButton,
RectangularElevationBehavior,
BaseRaisedButton,
BasePressedButton,
):
pass
class MDFloatingActionButton(
BaseRoundButton, CircularElevationBehavior, BaseRaisedButton
def __init__(self, **kwargs):
super().__init__(**kwargs)
if self.button_text != "":
button = MDFlatButton(text=self.button_text)
self.ids.box.add_widget(button)
if self.button_callback:
button.bind(on_release=self.button_callback)
instance_content_dialog.ids.sep
)
box_buttons = AnchorLayout(
anchor_x="right", size_hint_y=None, height=dp(30)
)
box = BoxLayout(size_hint_x=None, spacing=dp(5))
box.bind(minimum_width=box.setter("width"))
button_ok = MDRaisedButton(
text=self.text_button_ok,
on_release=lambda x: _events_callback(self.text_button_ok),
)
box.add_widget(button_ok)
if self.text_button_cancel != "":
button_cancel = MDFlatButton(
text=self.text_button_cancel,
theme_text_color="Custom",
text_color=self.theme_cls.primary_color,
on_release=lambda x: _events_callback(
self.text_button_cancel
),
)
box.add_widget(button_cancel)
box_buttons.add_widget(box)
instance_content_dialog.ids.box_buttons.add_widget(box_buttons)
instance_content_dialog.ids.box_buttons.height = button_ok.height
instance_content_dialog.remove_widget(
instance_content_dialog.ids.sep
)
class MDRoundImageButton(MDFloatingActionButton):
source = StringProperty()
"""Button image."""
_current_button_color = [1, 1, 1, 1]
def on_source(self, instance, value):
self.source = value
def on_size(self, instance, value):
self.remove_widget(self.ids.lbl_txt)
class MDRectangleFlatButton(MDFlatButton):
pass
class MDRoundFlatButton(MDFlatButton):
_radius = NumericProperty(dp(18))
def lay_canvas_instructions(self):
with self.canvas.after:
StencilPush()
RoundedRectangle(
size=self.size, pos=self.pos, radius=[self._radius]
)
StencilUse()
self.col_instruction = Color(rgba=self.ripple_color)
self.ellipse = Ellipse(
size=(self.ripple_rad, self.ripple_rad),
"""Button image."""
_current_button_color = [1, 1, 1, 1]
def on_source(self, instance, value):
self.source = value
def on_size(self, instance, value):
self.remove_widget(self.ids.lbl_txt)
class MDRectangleFlatButton(MDFlatButton):
pass
class MDRoundFlatButton(MDFlatButton):
_radius = NumericProperty(dp(18))
def lay_canvas_instructions(self):
with self.canvas.after:
StencilPush()
RoundedRectangle(
size=self.size, pos=self.pos, radius=[self._radius]
)
StencilUse()
self.col_instruction = Color(rgba=self.ripple_color)
self.ellipse = Ellipse(
size=(self.ripple_rad, self.ripple_rad),
pos=(
self.ripple_pos[0] - self.ripple_rad / 2.0,
self.ripple_pos[1] - self.ripple_rad / 2.0,
),