| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 
 |  
from kivy.lang import Builder
from kivy.adapters.listadapter import ListAdapter
 
Builder.load_string("""
[CustomListItemEncasement@SelectableView+BoxLayout]:
        orientation: 'horizontal'
        spacing: '10sp'
        padding: (sp(2), 0)
        size_hint_y: None
        height: '100sp'
        index: ctx.index
        canvas.after:
                Color:
                        rgb: 0.5,0.5,0.5
                Line:
                        rectangle: self.x,self.y+self.height,self.width,0
 
 
        # icon of item
        ListItemButton:
                id: mainListItemButton
                size_hint_x: None
                width: '110sp'
                selected_color: 1,1,1, 1
                deselected_color: 1,1,1, 1
                background_color: 1,1,1, 1
                background_normal: "images/fac-icon.png"
                background_down: "images/"+ctx.text+".png"
                border: (0,0,0,0)
 
        ListItemButton:
                selected_color: 0.9,0.9,0.8, 1
                deselected_color: 1,1,1, 0
                background_color: 1,1,1, 0
                background_normal: ""
                background_down: ""
 
                halign: 'left'
                text_size: (self.width , None)
                color: [1,1,1, 1]
                text: ctx.text
                markup: True
                font_size: '18sp'
                font_color: 1, 0.5,1,0.5
                font_name: "fonts/Ubuntu-M.ttf"
 
 
""")
 
def update_display(self):
        self._encasements = WebserviceToDataBase().getAllEncasementsForClient(self._Idclient)
        if self._encasements is None:
            return
 
        try:  #récupération des infos relatives à l'ID  "_Idclient"
            con = sqlite3.connect(WebserviceToDataBase().database)
            cur = con.cursor()
            cur.execute("SELECT * FROM tbl_client where idcli='%s'"%self._Idclient)
            row = cur.fetchone()
            self.lib=str(row[1])
        except sqlite3.Error, e:
            print "Error with database: %s" % e
        finally:
            if con:
                con.close()
        self.title_button.text = self.lib
 
        list_item_args_converter = \
            lambda row_index, obj: {'text': 'Code :  '+self._encasements[obj]["idfac"]+'\n'+'Montant :  '+str(self._encasements[obj]["montant"])+'\n'+'Date echeance :  '+str(self._encasements[obj]["echeance"]),
									'index': row_index,
									'is_selected': False
									}
 
        my_adapter = ListAdapter(data = self._encasements,
									args_converter=list_item_args_converter,
									selection_mode='multiple',
									allow_empty_selection=True,
									template='CustomListItemEncasement')
 
 
        self.containerListView.adapter = my_adapter
 
   def items_selected(self, adapter, *args):
        liste_index=[]
        if len(adapter.selection) == 0:
            return
        for item in adapter.selection:
             liste_index.append(adapter.data[item.index]) | 
Partager