Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # luis carlos pallares ascanio
- # card in RecycleView
- from kivymd.app import MDApp
- from kivy.factory import Factory
- from kivy.lang import Builder
- from kivy.metrics import dp
- from kivy.core.window import Window
- from kivymd.uix.list import OneLineAvatarListItem
- from kivy.properties import ListProperty, StringProperty
- from kivy.uix.modalview import ModalView
- from kivymd.uix.card import MDCard
- #from kivymd.toast import toast
- Builder.load_string("""
- #:import MDRaisedButton kivymd.uix.button.MDRaisedButton
- #:import hex kivy.utils.get_color_from_hex
- #:import MDDropdownMenu kivymd.uix.menu.MDDropdownMenu
- <MiEtiqueta@Label>
- # color: 0, 0, 0, 1
- # color: 1, 1, 1, 1
- # color: hex("#4E5862")
- size_hint: None, None
- size: self.texture_size
- pos_hint: {'center_y': .5}
- multiline: True
- <MiBotonIcono@MDIconButton>
- theme_text_color: 'Custom'
- text_color: hex("#afafaf")
- # pos_hint: {"down": .1, "left": .1}
- size_hint: 1, 1
- <MiPantalla@Screen>
- RecycleView:
- id: reciclaje
- key_viewclass: 'viewclass'
- key_size: 'height'
- RecycleBoxLayout:
- padding: dp(0)
- spacing: dp(10)
- default_size: None, dp(48)
- default_size_hint: 1, None
- size_hint_y: None
- height: self.minimum_height
- orientation: 'vertical'
- canvas:
- Color:
- rgb: hex("#17212d")
- Rectangle:
- size: self.size
- pos: self.pos
- <Tarjetas>
- padding: dp(0)
- spacing: dp(5)
- elevation: 10
- canvas:
- Color:
- rgb: hex("#1b2936")
- Rectangle:
- size: self.size
- pos: self.pos
- BoxLayout:
- orientation: 'vertical'
- Contenido:
- Iconos:
- <Contenido@MDBoxLayout>:
- orientation: 'vertical'
- #adaptive_height: True
- md_bg_color: hex("#1b2936")
- MDBoxLayout:
- orientation: 'vertical'
- size_hint: 1, .2
- #adaptive_height: True
- #md_bg_color: hex("#000000")
- MiEtiqueta:
- text:
- '''
- 'El aventurero espacial Peter Quill se convierte en presa
- 'él hace una alianza con un grupo de cuatro alienígenas.
- '''.replace("'", '')
- MiEtiqueta:
- text: 'colombia'
- color: hex("#F25050")
- Image:
- size_hint: 1, .715
- canvas.before:
- Color:
- rgb: hex("#a3a4a4")
- Rectangle:
- size: self.size
- pos: self.pos
- source: "go.jpg"
- <Iconos@MDBoxLayout>:
- orientation: 'horizontal'
- size_hint: 1, .1
- #adaptive_height: True
- #md_bg_color: hex("#000000")
- MiBotonIcono:
- icon: 'arrow-up-bold-circle'
- # size_hint: 1, .1
- on_press:
- self.text_color = hex("#ff8c60") if self.text_color == hex("#afafaf") else hex("#afafaf")
- MiBotonIcono:
- icon: 'arrow-down-bold-circle'
- # size_hint: 1, .1
- on_press:
- self.text_color = hex("#7193ff") if self.text_color == hex("#afafaf") else hex("#afafaf")
- MiBotonIcono:
- icon: 'star'
- on_press:
- self.text_color = hex("#fec409") if self.text_color == hex("#afafaf") else hex("#afafaf")
- MiBotonIcono:
- icon: 'comment-text-outline'
- MiBotonIcono:
- icon: 'exit-to-app'
- MiBotonIcono:
- icon: 'dots-vertical'
- on_release:
- app.abrir()
- <ElementosLista>
- theme_text_color: 'Custom'
- divider: None
- color: hex("#4E5862")
- IconLeftWidget:
- icon: root.icono
- text_color: hex("#afafaf")
- <VentanaEmergente>
- size_hint: None, None
- size: 327, 427
- # ELEMENTOS
- ScrollView:
- id: sc
- pos_hint: {"top": 1}
- MDGridLayout:
- id: box_item
- cols: 1
- size_hint_y: None
- height: self.minimum_height
- #adaptive_height: True
- #md_bg_color: hex("#1b2936")
- #md_bg_color: app.theme_cls.primary_color
- """)
- class Tarjetas(MDCard):
- '''
- def abrir(self):
- popup = VentanaEmergente()
- popup.open()
- '''
- class ElementosLista(OneLineAvatarListItem):
- icono = StringProperty()
- class VentanaEmergente(ModalView):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- for items in {
- "home-circle-outline": "Inicio",
- "update": "Buscar Actualizacion",
- "settings-outline": "Ajustes",
- "exit-to-app": "Salir",
- }.items():
- self.ids.box_item.add_widget(
- ElementosLista(
- text=items[1],
- icono=items[0],
- )
- )
- class Test(MDApp):
- menu_items = ListProperty()
- def __init__(self, **kwargs):
- self.title = "Boost"
- super().__init__(**kwargs)
- '''
- def build(self):
- return Factory.MiPantalla()
- '''
- def build(self):
- self.root = Factory.MiPantalla()
- def on_start(self):
- for i in range(5000): # 50 Tarjetas en reciclaje
- self.root.ids.reciclaje.data.append(
- {
- "viewclass": "Tarjetas",
- "height": dp(450) # tamaño tarjetas 64
- }
- )
- def abrir(self):
- popup = VentanaEmergente()
- popup.open()
- if __name__ == '__main__':
- #Window.size = (361, 641) #size of phone
- Test().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement