How to use the kivymd.ripplebehavior.RectangularRippleBehavior function in kivymd

To help you get started, we’ve selected a few kivymd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AndreMiras / KivyMD / kivymd / grid.py View on Github external
id: boxlabel
            font_style: "Caption"
            halign: "center"
            text: root.text
""")


class Tile(ThemableBehavior, RectangularRippleBehavior, ButtonBehavior,
           BoxLayout):
    """A simple tile. It does nothing special, just inherits the right behaviors
    to work as a building block.
    """
    pass


class SmartTile(ThemableBehavior, RectangularRippleBehavior, ButtonBehavior,
                FloatLayout):
    """A tile for more complex needs.

    Includes an image, a container to place overlays and a box that can act
    as a header or a footer, as described in the Material Design specs.
    """

    box_color = ListProperty([0, 0, 0, 0.5])
    """Sets the color and opacity for the information box."""

    box_position = OptionProperty('footer', options=['footer', 'header'])
    """Determines wether the information box acts as a header or footer to the
    image.
    """

    lines = OptionProperty(1, options=[1, 2])
github Joelzeller / CoPilot / kivymd / button.py View on Github external
Animation.cancel_all(self, 'elevation')
            self.elevation = 0
        return super(MDRaisedButton, self).on_touch_up(touch)

    def on_text(self, instance, text):
        self._text = text.upper()

    def on__elev_norm(self, instance, value):
        self.elevation_release_anim = Animation(elevation=value,
                                                duration=.2, t='out_quad')

    def on__elev_raised(self, instance, value):
        self.elevation_press_anim = Animation(elevation=value,
                                              duration=.2, t='out_quad')

class JZLargeButton(ThemableBehavior, RectangularRippleBehavior,
                     ElevationBehavior, ButtonBehavior,
                     AnchorLayout):
    _bg_color_down = ListProperty([])
    background_color = ListProperty()
    background_color_down = ListProperty()
    background_color_disabled = ListProperty()
    theme_text_color = OptionProperty(None, allownone=True,
                                      options=['Primary', 'Secondary', 'Hint',
                                               'Error', 'Custom'])
    text_color = ListProperty(None, allownone=True)

    def _get_bg_color_down(self):
        return self._bg_color_down

    def _set_bg_color_down(self, color, alpha=None):
        if len(color) == 2:
github AndreMiras / KivyMD / kivymd / button.py View on Github external
if self.theme_cls.theme_style == 'Dark':
            c = (1., 1., 1., 0.12)
        else:
            c = (0., 0., 0., 0.12)
        return c


class BaseRoundButton(CircularRippleBehavior, BaseButton):
    '''
    Abstract base class for all round buttons, bringing in the appropriate
    on-touch behavior
    '''
    pass


class BaseRectangularButton(RectangularRippleBehavior, BaseButton):
    '''
    Abstract base class for all rectangular buttons, bringing in the
    appropriate on-touch behavior. Also maintains the correct minimum width
    as stated in guidelines.
    '''
    width = BoundedNumericProperty(dp(88), min=dp(88), max=None,
                                   errorhandler=lambda x: dp(88))
    text = StringProperty('')
    _capitalized_text = StringProperty('')

    def on_text(self, instance, value):
        self._capitalized_text = value.upper()


class MDIconButton(BaseRoundButton, BaseFlatButton, BasePressedButton):
    icon = StringProperty('checkbox-blank-circle')
github AndreMiras / KivyMD / kivymd / list.py View on Github external
selected = ObjectProperty()
    _min_list_height = dp(16)
    _list_vertical_padding = dp(8)

    icon = StringProperty()

    def add_widget(self, widget, index=0):
        super(MDList, self).add_widget(widget, index)
        self.height += widget.height

    def remove_widget(self, widget):
        super(MDList, self).remove_widget(widget)
        self.height -= widget.height


class BaseListItem(ThemableBehavior, RectangularRippleBehavior,
                   ButtonBehavior, FloatLayout):
    '''Base class to all ListItems. Not supposed to be instantiated on its own.
    '''

    text = StringProperty()
    '''Text shown in the first line.

    :attr:`text` is a :class:`~kivy.properties.StringProperty` and defaults
    to "".
    '''

    text_color = ListProperty(None)
    ''' Text color used if theme_text_color is set to 'Custom' '''

    font_style = OptionProperty(
        'Subhead', options=['Body1', 'Body2', 'Caption', 'Subhead', 'Title',
github AndreMiras / KivyMD / kivymd / ripplebehavior.py View on Github external
def _set_ellipse(self, instance, value):
        super(RectangularRippleBehavior, self)._set_ellipse(instance, value)
        self.ellipse.pos = (self.ripple_pos[0] - self.ripple_rad / 2.,
                            self.ripple_pos[1] - self.ripple_rad / 2.)
github Joelzeller / CoPilot / kivymd / button.py View on Github external
elif self.disabled:
            return False
        else:
            self.fade_bg = Animation(duration=.2, _current_button_color=get_color_from_hex(
                                     colors[self.theme_cls.theme_style]['FlatButtonDown']))
            self.fade_bg.start(self)
            return super(MDFlatButton, self).on_touch_down(touch)

    def on_touch_up(self, touch):
        if touch.grab_current is self:
            self.fade_bg.stop_property(self, '_current_button_color')
            Animation(duration=.05, _current_button_color=self.background_color).start(self)
        return super(MDFlatButton, self).on_touch_up(touch)


class MDRaisedButton(ThemableBehavior, RectangularRippleBehavior,
                     ElevationBehavior, ButtonBehavior,
                     AnchorLayout):
    _bg_color_down = ListProperty([])
    background_color = ListProperty()
    background_color_down = ListProperty()
    background_color_disabled = ListProperty()
    theme_text_color = OptionProperty(None, allownone=True,
                                      options=['Primary', 'Secondary', 'Hint',
                                               'Error', 'Custom'])
    text_color = ListProperty(None, allownone=True)

    def _get_bg_color_down(self):
        return self._bg_color_down

    def _set_bg_color_down(self, color, alpha=None):
        if len(color) == 2:
github Joelzeller / CoPilot / kivymd / button.py View on Github external
theme_text_color = OptionProperty(None, allownone=True,
                                      options=['Primary', 'Secondary', 'Hint',
                                               'Error', 'Custom'])
    text_color = ListProperty(None, allownone=True)
    opposite_colors = BooleanProperty(False)

class JZInvisiButton(CircularRippleBehavior, ButtonBehavior, BoxLayout):
    icon = StringProperty('circle')
    theme_text_color = OptionProperty(None, allownone=True,
                                      options=['Primary', 'Secondary', 'Hint',
                                               'Error', 'Custom'])
    text_color = ListProperty(None, allownone=True)
    opposite_colors = BooleanProperty(False)


class MDFlatButton(ThemableBehavior, RectangularRippleBehavior,
                   ButtonBehavior, BackgroundColorBehavior, AnchorLayout):
    width = BoundedNumericProperty(dp(64), min=dp(64), max=None,
                                   errorhandler=lambda x: dp(64))

    text_color = ListProperty()

    text = StringProperty('')
    theme_text_color = OptionProperty(None, allownone=True,
                                      options=['Primary', 'Secondary', 'Hint',
                                               'Error', 'Custom'])
    text_color = ListProperty(None, allownone=True)

    _text = StringProperty('')
    _bg_color_down = ListProperty([0, 0, 0, 0])
    _current_button_color = ListProperty([0, 0, 0, 0])
github AndreMiras / KivyMD / kivymd / grid.py View on Github external
pos: self.pos
                size: self.size
        id: box
        size_hint_y: None
        height: dp(68) if root.lines == 2 else dp(48)
        x: root.x
        y: root.y if root.box_position == 'footer' else root.y + root.height - self.height
        MDLabel:
            id: boxlabel
            font_style: "Caption"
            halign: "center"
            text: root.text
""")


class Tile(ThemableBehavior, RectangularRippleBehavior, ButtonBehavior,
           BoxLayout):
    """A simple tile. It does nothing special, just inherits the right behaviors
    to work as a building block.
    """
    pass


class SmartTile(ThemableBehavior, RectangularRippleBehavior, ButtonBehavior,
                FloatLayout):
    """A tile for more complex needs.

    Includes an image, a container to place overlays and a box that can act
    as a header or a footer, as described in the Material Design specs.
    """

    box_color = ListProperty([0, 0, 0, 0.5])
github Joelzeller / CoPilot / kivymd / ripplebehavior.py View on Github external
def _set_ellipse(self, instance, value):
        super(RectangularRippleBehavior, self)._set_ellipse(instance, value)
        self.ellipse.pos = (self.ripple_pos[0] - self.ripple_rad / 2.,
                            self.ripple_pos[1] - self.ripple_rad / 2.)