Example #1
0
def mk_threadListEntry(ind, t, txt):
    # m = MyThreadListEntry()
    m = GridLayout(cols=1, size_hint_y=None, spacing=0)
    m.bind(minimum_height=m.setter('height'))
    m.ind = NumericProperty()
    m.ind = ind
    m.thread = ObjectProperty()
    m.thread = t
    l = Button(text=txt[0][1],
               size_hint_y=None,
               height=45,
               padding=(10, 10),
               font_size="28",
               font_name="Arial bold",
               background_normal='',
               background_down='',
               background_color=(.7, .7, .9, 1) if ind % 2 == 0 else
               (.9, .7, .7, 1),
               color=(0, 0, 0, 1),
               text_size=(700, 50),
               shorten=True,
               shorten_from='right')
    l.bind(on_release=(lambda x: print(x.parent.ind)))
    m.add_widget(l)
    g = GridLayout(cols=3,
                   size_hint=(1, None),
                   spacing=0,
                   row_default_height=40)
    g.bind(minimum_height=g.setter('height'))
    m.add_widget(g)

    for ln in txt[1:]:
        l = Button(text=' ' + ln[1],
                   size_hint_x=None,
                   font_size="24",
                   background_normal='',
                   background_down='',
                   background_color=(.7, .7, .9, 1) if ind % 2 == 0 else
                   (.9, .7, .7, 1),
                   color=(0, 0, 0, 1),
                   halign='left',
                   text_size=(120, None),
                   width=140,
                   shorten=True,
                   shorten_from='right')
        # l.bind(on_touch_down = (lambda x,y: True))
        l.bind(on_release=(lambda x: print(x.parent.parent.ind)))
        g.add_widget(l)
        l = Button(text=ln[2],
                   size_hint_x=None,
                   padding_x=5,
                   font_size="24",
                   font_name="Arial italic",
                   background_normal='',
                   background_down='',
                   background_color=(.7, .7, .9, 1) if ind % 2 == 0 else
                   (.9, .7, .7, 1),
                   color=(0, 0, 0, 1),
                   halign='left',
                   text_size=(430, None),
                   width=430,
                   shorten=True,
                   shorten_from='right')
        # l.bind(on_touch_down = (lambda x,y: True))
        l.bind(on_release=(lambda x: print(x.parent.parent.ind)))
        g.add_widget(l)
        l = Button(text=' ' + ln[0],
                   size_hint_x=None,
                   font_size="20",
                   background_normal='',
                   background_down='',
                   background_color=(.7, .7, .9, 1) if ind % 2 == 0 else
                   (.9, .7, .7, 1),
                   color=(0, 0, 0, 1),
                   halign='left',
                   text_size=(130, None),
                   width=130,
                   shorten=True,
                   shorten_from='right')
        # l.bind(on_touch_down = (lambda x,y: True))
        l.bind(on_release=(lambda x: print(x.parent.parent.ind)))
        g.add_widget(l)
    return m
    '''