Hello.
Problem. Recycleview with pictures. Pic can be broken and one is for tests. My class for images has __init__ with bind each element and send for check to another function:
class clMyImage(Image):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# From net: Bind the image size to our error handler
self.bind(size = self.m_handleBroken)
return None
def m_handleBroken(self, inst, value):
# From net: value will be None if the image fails to load
if self.texture is None:
inst.source = f"{gsPath2App}pic/brokenPic.jpg" # change src to `broken`
return None
Just to explain strange thing: size and texture. I found that solution (texture and texture) in internet but bind to texture doesn't work but with size and check for texture is working fine.
But this works only at begin. Each element is pass __init__ and I can catch broken pic. After adding new pics and change dict and pass as new for:
koRecView.data = gdFILES['lData']
It's showing (try to show) original broken pic. Is not going by __init__.
I try:
koRecView.refresh_from_data()
Is not going again by __init__ of my image class.
I try remove recycleview and add again. Is not helping. Maybe reload kv lang?
class clMyGridLayout(BL):
Builder.load_string(f'''<clMyGridLayout>:
orientation: "vertical"
RecycleView:
canvas.before:
Color:
rgba: 0,0,0,1 #{glBckColor}
Rectangle:
pos: self.pos
size: self.size
bar_color: {glSlidCol}
bar_inactive_color: {glInSlCol}
bar_width: {gnWinS / 50}
viewclass: 'clMyImage'
data: {gdFILES['lData']}
RecycleGridLayout: # this layout is in var: koRecGridLay
id: grid
cols: {str(gnCol)}
default_size: None, {gnWinW / gnCol * 0.75}
default_size_hint: 1, None
spacing: 10,10
padding: {gtThumbPadd}
size_hint_y: None
height: self.minimum_height
orientation: "lr-tb"''')
I am using PIL for exif so probably I can use PIL to verify images before I pass to recycleview, but this take extra time and if I can use kivy for this is I think better.
Radek Glebicki