Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecycleView não funciona mais com 3 linhas(ThreeLineRightIconListItem) #1748

Open
WinnePQD opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@WinnePQD
Copy link

WinnePQD commented Nov 8, 2024

Description of the Bug

Ola me chamo winne, e preciso da ajuda de vocês, eu estava escrevendo meu codigo com o KIVYMD 1.2.0, estava indo tudo certo
porém quando atualizei o kivyMD parou de funcionar o data do RecycleView, pois antes eu invocava eles assim ( self.rv_data = [{'text': str(x[0]),"secondary_text":"Preço Prom R$: " +str(x[1]),"tertiary_text":"Preço Normal R$: " +str(x[2]),'Index': str(x[0]), 'selectable':True}for x in data ] ), mas depois da atualização nao exite mais tertiary_text.
Minha pergunta é :
COMO CONSEGUIR NOVAMENTE QUE O RECYCLEVIEW FUNCIONE COM 3 LINHAS DE INFORMAÇÔES NOVAMENTE., POIS
COM ESSA ATUALIZAÇÃO SO FUNCIONA COM 1 LINHA.
SEGUE IMAGEM DE COMO É O PROGRAMA.

WhatsApp Image 2024-11-08 at 18 59 25

Code and Logs

Builder.load_string(
    '''

<CustomOneLineIconListItem>:
    active: stored_state.active
    CheckBox:
        id: stored_state
       # active: root.active
        size_hint: None, None
        size: "48dp", "48dp"
        pos_hint: {'center_x': .8, 'center_y': .2}
        on_release: root.store_checkbox_state()

<PreviousMDIcons>

    MDBoxLayout:
        orientation: 'vertical'
        spacing: dp(10)
        padding: dp(20)
  
        

        

        MDBoxLayout:
            adaptive_height: True
            
            

            MDIconButton:
                icon: 'magnify'
                pos_hint: {"center_x": .1}
                on_press:root.hdjdh()
            

            MDTextField:
                id: search_field
                hint_text: 'procurar o produto'
                text:""
                
                on_text: root.text_field(self.text, True)
                
        MDBoxLayout:
            adaptive_height: True
            orientation: 'horizontal'
            pos_hint: {"center_x": dp(.2), "center_y": dp(.1)}
                    
            MDRaisedButton:
                id: button
                text: "SETORES"
                pos_hint: {"center_x": dp(.2), "center_y": dp(.25)}
                on_release: root.menu_open()
             # 
#            FloatLayout:
#                pos_hint: {"center_x":.5, "center_y":.9}

            
                
            MDLabel:
                id:texto
                text:""
               # pos_hint: {"center_x": dp(.5), "center_y": dp(.12)}
          
               # spacing: dp(10)
                
            CheckBox:
                id: stored_state             
                size_hint: None, None
                color_active: "red"
                checkbox_icon_normal:"blue"
                md_bg_color_disabled:"blue"
                size: "48dp", "48dp"
                #pos_hint: {"center_y": .5}
                color:"black"
                #on_release: root.store_checkbox_state()
            
            
                    
        
        RecycleView:
            viewclass: 'CustomOneLineIconListItem'
            data: root.rv_data
            id:view
            
                       
                    
            RecycleBoxLayout:
                padding: dp(3)
                default_size: None, dp(80)
                default_size_hint: 1.1, None
                size_hint_y: None
                height: self.minimum_height
                orientation: 'vertical'
'''
)



class CustomOneLineIconListItem(RecycleDataViewBehavior,ThreeLineRightIconListItem):
    text = StringProperty()
    generated_state_text = StringProperty()
    active = BooleanProperty()
    index = 0
    rv_data = ListProperty([])

    def store_checkbox_state(self):
      print('oi')

class PreviousMDIcons(RecycleView):

    rv_data = ListProperty([])
    def _init_(self, **kwargs):
        super(PreviousMDIcons,self)._init_(**kwargs)
        Clock.schedule_interval(self.text_field, 0.5)
        

     
    def apagar_recy(self,dt):
        
    
        #text=self.ids.search_field.text
        if self.text !="": 
            print(self.text)
            #df = pandas.read_excel("/storage/emulated/0/testee.xlsx")
 
            data=[] 
            #for index, row in df.iterrows():
            for index, row in self.teste.iterrows():
                if self.text in str(row['Descrição mercadoria']):
      
                    data.append([row['Descrição mercadoria'],row['Preç.Clube'],row["Preç.Vigen"]])
                            
                    self.rv_data = [{'text': str(x[0]),"secondary_text":"Preço Clube R$: " +str(x[1]),"tertiary_text":"Preço Normal R$: " +str(x[2]),'Index': str(x[0]), 'selectable':True}for x in data ]
                    
  

class MainApp(MDApp):

    def build(self):
        #return self.screen
        return PreviousMDIcons()
        


MainApp().run()

Screenshots

Add images to explain us this bug. Paste urls here.

Remove this section if no images here

Versions

  • OS:
  • Python:
  • Kivy:
  • KivyMD:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant