Sunday, 13 June 2021

MDSelectionList properties cannot be modified

I am using an MDSelectionList inside a tab with an MDNavigationRail to switch between screens, however, when I try to customize the MDSelectionList, none of the visual changes apply. I thought that maybe it is a problem with the widget itself but then I separated it and the property changes worked. How can I make the changes apply to the selection list? (I am using kivymd 0.104.2.dev0 from the master branch) My Code:

from kivy.config import Config

Config.set('graphics', 'width', '850')
Config.set('graphics', 'height', '530')
Config.set('graphics', 'minimum_width', '850')
Config.set('graphics', 'minimum_height', '530')
from kivy.lang import Builder
from kivymd.uix.card import MDCard
from kivymd.uix.tab import MDTabsBase
from kivymd.app import MDApp


class SettingsTab(MDCard, MDTabsBase):
    pass

class Example(MDApp):

    def __init__(self, **kwargs):
        super(Example, self).__init__(**kwargs)
        self.kv = Builder.load_string('''
#:kivy 2.0.0
<SettingsTab>:
    orientation: "vertical"
    size_hint: .95, .95
    pos_hint: {"center_x": .5, "center_y": .5}
    border_radius: 5
    radius: [5]
    elevation: 20
BoxLayout:
    MDNavigationRail:
        color_active: app.theme_cls.primary_color
        MDNavigationRailItem:
            icon: "list-status"
            on_release:
                screens.current = "downloads_screen"
        MDNavigationRailItem:
            icon: "cog"
            on_release:
                screens.current = "settings"
        MDNavigationRailItem:
            icon: "information"
            on_release:
                screens.current = "activity_log"

    ScreenManager:
        id: screens
        Screen:
            name: "downloads_screen"
        Screen:
            name: "activity_log"
        Screen:
            name: "settings"
            MDTabs:
                SettingsTab:
                    title: "DOWNLOAD"
                    MDSelectionList:
                        overlay_color: 1, 0, 0, .5
                        icon_bg_color: 0, 0, 0, 0
                        icon_check_color: 0, 0, 0, 0
                        OneLineIconListItem:
                            text: "Just me!"
                            IconLeftWidget:
                                icon: "circle-outline"
                                pos_hint: {"center_x": .5, "center_y": .5}
                        OneLineIconListItem:
                            text: "Just me!"
                            IconLeftWidget:
                                icon: "circle-outline"
                        OneLineIconListItem:
                            text: "Just me!"
                            IconLeftWidget:
                                icon: "circle-outline"
                        OneLineIconListItem:
                            text: "Just me!"
                            IconLeftWidget:
                                icon: "circle-outline"
                SettingsTab:
                    title: "COLOR"
                SettingsTab:
                    title: "INFO"''')

    def build(self):
        self.theme_cls.theme_style = "Dark"
        self.theme_cls.primary_palette = "Blue"
        self.theme_cls.accent_palette = "Teal"
        return self.kv


if __name__ == '__main__':
    Example().run()


from MDSelectionList properties cannot be modified

No comments:

Post a Comment