Esempio n. 1
0
    def __set_properties(self):
        self.SetMinSize(self.minSize)
        self.bouton_fermer.SetToolTip(u"Cliquez ici pour fermer")
        self.listview.SetToolTip(u"Double Cliquez pour choisir")
        # Couleur en alternance des lignes
        self.listview.oddRowsBackColor = "#F0FBED"
        self.listview.evenRowsBackColor = wx.Colour(255, 255, 255)
        self.listview.useExpansionColumn = True

        if self.nbColonnes >1:
            filCode = False
        else: filCode = True
        lstColumns = [
            ColumnDefn("Code", "left", 0, 0),
            ColumnDefn("Code", "left", self.wCode, 0,isSpaceFilling=filCode),]
        if self.nbColonnes >1:
            texte = "Libelle (non modifiables)"
            for ix in range(1,self.nbColonnes):
                lstColumns.append(ColumnDefn(texte, "left", self.wLib, ix, isSpaceFilling=True))
                texte = "-"

        self.listview.SetColumns(lstColumns)
        self.listview.SetSortColumn(self.columnSort)
        self.listview.CreateCheckStateColumn(0)
        self.listview.SetObjects(self.liste)
Esempio n. 2
0
def GetOlvColonnes(dlg):
    # retourne la liste des colonnes de l'écran principal, valueGetter correspond aux champ des tables ou calculs
    lstCol = [
            ColumnDefn("Article", 'left', 200, 'IDarticle', valueSetter=" ",isSpaceFilling=True,
                       isEditable=False),
            ColumnDefn("Fournisseur", 'left', 100, 'fournisseur', valueSetter=" ",isSpaceFilling=True,
                       isEditable=False),
            ColumnDefn("Magasin", 'left', 100, 'magasin', valueSetter=" ",isSpaceFilling=True,
                       isEditable=False),
            ColumnDefn("Rayon", 'left', 100, 'rayon', valueSetter=" ",isSpaceFilling=True,
                       isEditable=False),
            ColumnDefn("Qté stock", 'right', 80, 'qteConstat',  valueSetter=0.0,isSpaceFilling=False,
                                        stringConverter=xformat.FmtDecimal),
            ColumnDefn("Prix Unit Moy", 'right', 85, 'pxUn',  valueSetter=0.0,isSpaceFilling=False,
                                        stringConverter=xformat.FmtDecimal),
            ColumnDefn("Mtt TTC", 'right', 100, 'mttTTC',  valueSetter=0.0,isSpaceFilling=False,
                        isEditable=False, stringConverter=xformat.FmtDecimal, ),
            ColumnDefn("QteMini", 'right', 80, 'mini',  valueSetter=0.0,isSpaceFilling=False,
                        isEditable=False, stringConverter=xformat.FmtDecimal, ),
            ColumnDefn("Nbre Rations", 'right', 80, 'rations',  valueSetter=0.0,isSpaceFilling=False,
                        isEditable=False, stringConverter=xformat.FmtDecimal, ),
            ColumnDefn("Vérifié au", 'left', 80, 'IDdate', valueSetter=datetime.date.today(),isSpaceFilling=False,
                        isEditable=False, stringConverter=xformat.FmtDate,),
            ]
    return lstCol
Esempio n. 3
0
def GetOlvColonnes(dlg):
    # retourne la liste des colonnes de l'écran principal, valueGetter correspond aux champ des tables ou calculs
    return [
            ColumnDefn("pbImpress", 'right', 0,'pbImp', valueSetter=''),
            ColumnDefn("Article", 'left', 200, 'IDarticle', valueSetter="", isSpaceFilling=True),
            ColumnDefn("Rayon", 'left', 80, 'rayon', valueSetter="", isSpaceFilling=False),
            ColumnDefn("Qté", 'right', 80, 'qte', valueSetter=0, stringConverter=xformat.FmtDecimal,isSpaceFilling=False),
            ColumnDefn("PrixUn", 'right', 80, 'prixUn', valueSetter=0, stringConverter=xformat.FmtDecimal,isSpaceFilling=False),
            ColumnDefn("Coût", 'right', 80, 'cout', valueSetter=0, stringConverter=xformat.FmtDecimal,isSpaceFilling=False),
            ColumnDefn("NbRepas", 'right', 80, 'nbRepas', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=False),
            ColumnDefn("PrixParRepas", 'right', 80,'prixRepas', valueSetter=0, stringConverter=xformat.FmtDecimal,isSpaceFilling=False),
            ColumnDefn("NbClients", 'right', 80, 'nbClients', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=False),
            ColumnDefn("PrixJourClient", 'right', 80, 'prixClient', valueSetter=0, stringConverter=xformat.FmtDecimal,isSpaceFilling=False),
            ]
Esempio n. 4
0
    def InitOlv(self):
        self.listview = FastObjectListView(self, style=wx.LC_REPORT)
        self.listview.SetToolTip(u"Double Cliquez pour choisir")
        # Couleur en alternance des lignes
        self.listview.oddRowsBackColor = "#F0FBED"
        self.listview.evenRowsBackColor = wx.Colour(255, 255, 255)
        self.listview.useExpansionColumn = True
        self.listview.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnDblClicOk)

        lstColumns = []
        self.lstCodes = [xformat.NoAccents(x) for x in self.lstColonnes]
        for ix in range(self.nbColonnes):
            width = self.lstWcol[ix]
            label = self.lstColonnes[ix]
            code = self.lstCodes[ix]
            setter = self.lstSetters[ix]
            lstColumns.append(
                ColumnDefn(label, "left", width, code, isSpaceFilling=True))

        self.listview.SetColumns(lstColumns)
        self.listview.SetSortColumn(self.columnSort)
        if self.withCheck:
            self.listview.CreateCheckStateColumn()

        self.tracks = [Track(don, self.lstCodes) for don in self.lstDonnees]

        self.listview.SetObjects(self.tracks)
        self.listview.Refresh()
Esempio n. 5
0
 def ComposeColonnes(self,lstColonnes,lstWcol=None):
     lstDefn = []
     if lstWcol and len(lstWcol) != len(lstColonnes):
         lstWcol = None
     width = -1
     spFil = True
     for colonne in lstColonnes:
         if lstWcol:
             width = lstWcol[lstColonnes.index(colonne)]
             if width != -1 : spFil = False
         code = xdb.NoPunctuation(colonne)
         lstDefn.append(ColumnDefn(colonne, "left",width,code,isSpaceFilling=spFil))
     return lstDefn
Esempio n. 6
0
def GetOlvColonnes(dlg):
    # retourne la liste des colonnes de l'écran principal, valueGetter correspond aux champ des tables ou calculs
    return [
            ColumnDefn("Date", 'left', 90,      'ID', valueSetter=datetime.date.today(),stringConverter=xformat.FmtDate),
            ColumnDefn("RepasMidi", 'right', 72, 'midiRepas', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=True),
            ColumnDefn("RepasSoir", 'right', 72,   'soirRepas', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=True),
            ColumnDefn("ClientsMidi", 'right', 72,'midiClients', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=True),
            ColumnDefn("ClientsSoir", 'right', 72, 'soirClients', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=True),
            ColumnDefn("PrévuInscrits", 'right', 72, 'prevuRepas', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=True),
            ColumnDefn("PrévuClients", 'right', 72, 'prevuClients', valueSetter=0, stringConverter=xformat.FmtInt,isSpaceFilling=True),
            ]
Esempio n. 7
0
    def __set_properties(self):
        # TipString, Bind et constitution des colonnes de l'OLV
        self.SetMinSize(self.minSize)
        self.bouton_lettrer.SetToolTip(u"Cliquez ici après avoir coché des lignes à associer")
        self.bouton_delettrer.SetToolTip(u"Cliquez ici après avoir sélectionné une ligne de la lettre à supprimer")
        self.bouton_ok.SetToolTip(u"Cliquez ici pour valider et enregistrer les modifications")
        self.bouton_fermer.SetToolTip(u"Cliquez ici pour abandonner les modifications")
        self.listview.SetToolTip(u"Double Cliquez pour cocher")
        # Binds
        self.Bind(wx.EVT_BUTTON, self.OnClicOk, self.bouton_ok)
        self.Bind(wx.EVT_BUTTON, self.OnClicFermer, self.bouton_fermer)
        self.Bind(wx.EVT_BUTTON, self.OnClicLettrer, self.bouton_lettrer)
        self.Bind(wx.EVT_BUTTON, self.OnClicDelettrer, self.bouton_delettrer)
        self.listview.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnDblClic)

        # Couleur en alternance des lignes
        self.listview.oddRowsBackColor = "#F0FBED"
        self.listview.evenRowsBackColor = wx.Colour(255, 255, 255)
        self.listview.useExpansionColumn = True

        # Construction des colonnes de l'OLV
        lstColumns = [ ColumnDefn("coche", "left", 0, 0),]
        for ix in range(self.nbColonnes-2):
            if ix in (1,2):
                justif = 'right'
            else: justif = 'left'
            code = self.lstCodes[ix]
            lstColumns.append(ColumnDefn(self.lstLibels[ix], justif, width=self.lstWidth[ix], valueGetter=code,
                                         maximumWidth=self.lstWidth[ix],isEditable=False,isSpaceFilling=True,))
        lstColumns.append(ColumnDefn(self.lstLibels[-2],'right',maximumWidth=80,valueGetter="debits",stringConverter=xformat.FmtMontant,
                                     isEditable=False,isSpaceFilling=True))
        lstColumns.append(ColumnDefn(self.lstLibels[-1],'right',maximumWidth=80,valueGetter="credits",stringConverter=xformat.FmtMontant,
                                     isEditable=False,isSpaceFilling=True))
        self.listview.SetColumns(lstColumns)
        self.listview.SetSortColumn(self.columnSort)
        self.listview.CreateCheckStateColumn(0)
Esempio n. 8
0
def DefColonnes(lstNoms, lstCodes, lstValDef, lstLargeur):
    # Composition d'une liste de définition de colonnes d'un OLV; remarque faux ami: 'nom, code' == 'label, name'
    ix = 0
    for lst in (lstCodes, lstValDef, lstLargeur):
        # complète les listes entrées si nécessaire
        if lst == None: lst = []
        if len(lst) < len(lstNoms):
            lst.extend([''] * (len(lstNoms) - len(lst)))
    lstColonnes = []
    for colonne in lstNoms:
        if isinstance(lstValDef[ix], (str, wx.DateTime, datetime.date)):
            posit = 'left'
        else:
            posit = 'right'
        # ajoute un converter à partir de la valeur par défaut
        if isinstance(lstValDef[ix], (float, )):
            if '%' in colonne:
                stringConverter = FmtPercent
            else:
                stringConverter = FmtDecimal
        elif isinstance(lstValDef[ix], int):
            if '%' in colonne:
                stringConverter = FmtPercent
            else:
                stringConverter = FmtInt
        elif isinstance(lstValDef[ix], (datetime.date, wx.DateTime)):
            stringConverter = FmtDate
        else:
            stringConverter = None
        if lstLargeur[ix] in ('', None, 'None', -1):
            lstLargeur[ix] = -1
            isSpaceFilling = True
        else:
            isSpaceFilling = False
        code = lstCodes[ix]
        lstColonnes.append(
            ColumnDefn(title=colonne,
                       align=posit,
                       width=lstLargeur[ix],
                       valueGetter=code,
                       valueSetter=lstValDef[ix],
                       isSpaceFilling=isSpaceFilling,
                       stringConverter=stringConverter))
        ix += 1
    return lstColonnes
Esempio n. 9
0
def GetOlvColonnes(dlg):
    # retourne la liste des colonnes de l'écran principal, valueGetter correspond aux champ des tables ou calculs
    return [
        ColumnDefn("pbImpress", 'right', 0, 'pbImp', valueSetter=''),
        ColumnDefn("Date",
                   'right',
                   90,
                   'IDdate',
                   valueSetter=datetime.date.today(),
                   stringConverter=xformat.FmtDate),
        ColumnDefn("NbRepas",
                   'right',
                   80,
                   'nbRepas',
                   valueSetter=0,
                   stringConverter=xformat.FmtInt,
                   isSpaceFilling=True),
        ColumnDefn("NbClients",
                   'right',
                   80,
                   'nbClients',
                   valueSetter=0,
                   stringConverter=xformat.FmtInt,
                   isSpaceFilling=True),
        ColumnDefn("PrixParRepas",
                   'right',
                   100,
                   'prixRepas',
                   valueSetter=0,
                   stringConverter=xformat.FmtDecimal,
                   isSpaceFilling=True),
        ColumnDefn("PrixJourClient",
                   'right',
                   100,
                   'prixClient',
                   valueSetter=0,
                   stringConverter=xformat.FmtDecimal,
                   isSpaceFilling=True),
        ColumnDefn("Coût global",
                   'right',
                   100,
                   'cout',
                   valueSetter=0,
                   stringConverter=xformat.FmtDecimal,
                   isSpaceFilling=True),
    ]
Esempio n. 10
0
    def InitObjectListView(self):
        def FormateDate(dateDD):
            return xformat.DateComplete(dateDD)

        def FormateMontant(montant):
            if montant == None or montant == "": return ""
            return u"%.2f %s" % (montant, SYMBOLE)

        self.SetColumns([
            ColumnDefn(
                u"ID",
                "left",
                50,
                "ID",
            ),
            ColumnDefn(
                u"Texte",
                "left",
                100,
                "texte",
            ),
            ColumnDefn(
                u"Entier",
                "left",
                100,
                "entier",
            ),
            ColumnDefn(
                u"Date",
                "left",
                100,
                "date",
            ),
            ColumnDefn(
                u"Montant",
                "left",
                100,
                "montant",
                stringConverter=FormateMontant,
            ),
            ColumnDefn(
                u"Heure",
                "left",
                100,
                "heure",
            ),
        ])

        self.SetObjects(self.donnees)
Esempio n. 11
0
def AdaptDicOlv(dicOlv):
    # Si dicOlv est construit directement à partir du schéma des tables, il faut personnaliser
    ix = dicOlv['lstChamps'].index('type')
    (column,) = ColumnDefn("type", 'centre', 50, 'type',
                        valueSetter='L',
                        choices=['L','D','N'],
                        isSpaceFilling=False,
                        cellEditorCreator=CellEditor.ChoiceEditor),
    dicOlv['lstColonnes'][ix] = column

    ix = dicOlv['lstChamps'].index('tauxAmort')
    column = dicOlv['lstColonnes'][ix]
    column.title = "TauxLin"
    column.valueGetter = "tauxLin"
    dicOlv['lstColonnes'][ix] = column

    ix = dicOlv['lstChamps'].index('IDimmo')
    dicOlv['lstColonnes'][ix].width = 0
    dicOlv['lstColonnes'][ix].isEditable = False
    return dicOlv
        sizer_base.AddGrowableCol(0)
        sizer_base.AddGrowableRow(1)
        self.CenterOnScreen()
        self.Layout()
        self.SetSizerAndFit(sizer_base)


# ------------ Pour tests ------------------------------------------------------------------

if __name__ == '__main__':
    app = wx.App(0)
    os.chdir("..")
    # tableau OLV central de l'écran ,
    #                    stringConverter=xpy.outils.xformat.FmtMontant
    liste_Colonnes = [
        ColumnDefn("null", 'centre', 0, "IX", valueSetter=''),
        ColumnDefn("clé",
                   'centre',
                   60,
                   "cle",
                   valueSetter=True,
                   isSpaceFilling=False,
                   cellEditorCreator=CellEditor.BooleanEditor),
        ColumnDefn("mot d'ici",
                   'left',
                   200,
                   "mot",
                   valueSetter='A saisir',
                   isEditable=True),
        ColumnDefn("nbre",
                   'right',
Esempio n. 13
0
def GetOlvColonnes():
    # retourne la liste des colonnes de l'écran principal
    return [
            ColumnDefn("ID", 'centre', 0, 'IDreglement',
                       isEditable=False),
            ColumnDefn("date", 'center', 80, 'date', valueSetter=datetime.date.today(),isSpaceFilling=False,
                       stringConverter=xformat.FmtDate),
            ColumnDefn("famille", 'centre', 50, 'IDfamille', valueSetter=0,isSpaceFilling=False,
                       stringConverter=xformat.FmtIntNoSpce),
            ColumnDefn("désignation famille", 'left', 180, 'designation',valueSetter='',isSpaceFilling=True,
                       isEditable=False),
            ColumnDefn("payeur", 'left', 80, "payeur", valueSetter='', isSpaceFilling=True,
                        cellEditorCreator=CellEditor.ComboEditor),
            ColumnDefn("mode", 'centre', 60, 'mode', valueSetter='',choices=['VRT virement', 'CHQ chèque','ESP espèces'],
                       isSpaceFilling=False,
                        cellEditorCreator=CellEditor.ChoiceEditor),
            ColumnDefn("bqe ori.", 'centre', 120, 'emetteur',
                        isSpaceFilling=False,
                        cellEditorCreator=CellEditor.ChoiceEditor),
            ColumnDefn("n°ref", 'left', 50, 'numero', isSpaceFilling=False),
            ColumnDefn("nat", 'centre', 80, 'nature',valueSetter='Règlement',
                       choices=['Règlement','Acompte','Don','DonSsCerfa','Debour','Libre'], isSpaceFilling=False,
                        cellEditorCreator=CellEditor.ChoiceEditor),
            ColumnDefn("compte", 'left', 50, 'compte', isSpaceFilling=False,
                        isEditable=False),
            ColumnDefn("libelle", 'left', 200, 'libelle', valueSetter='', isSpaceFilling=True),
            ColumnDefn("montant", 'right',70, 'montant', isSpaceFilling=False, valueSetter=0.0,
                        stringConverter=xformat.FmtDecimal),
            ColumnDefn("créer", 'centre', 38, 'creer', valueSetter=True,
                        isEditable=False,
                        stringConverter=xformat.FmtBool),
            ColumnDefn("IDprestation", 'centre', 0, 'IDprestation',
                        isEditable=False),
            ColumnDefn("differé", 'center', 80, 'differe', valueSetter=datetime.date.today(), isSpaceFilling=False,
                        stringConverter=xformat.FmtDate,),
            ]
    """
    dicBandeau = {'titre':"MON TITRE", 'texte':"mon introduction", 'hauteur':15, 'nomImage':"xpy/Images/32x32/Matth.png"}
    dicOlv['dicBandeau'] = dicBandeau
    #exempleframe = DLG_tableau(None,dicOlv=dicOlv,lstBtns= None)
    exempleframe = DLG_xxtableau(None,dicOlv=dicOlv,lstBtns= None)
    app.SetTopWindow(exempleframe)
    ret = exempleframe.ShowModal()
    print("retour: ",ret)
    if ret == wx.OK :
        print(exempleframe.GetSelection().donnees)
    else: print(None)
    app.MainLoop()

    """
    liste_Colonnes = [
        ColumnDefn("null", 'centre', 0, 'IX', valueSetter=''),
        ColumnDefn("clé", 'centre', 60, 'cle', valueSetter=True,
                   isSpaceFilling=False ),
        ColumnDefn("mot d'ici", 'left', 200, 'mot', valueSetter='A saisir', isEditable=True),
        ColumnDefn("nbre", 'right', -1, 'nombre', isSpaceFilling=True, valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal),
        ColumnDefn("prix", 'left', 80, 'prix', valueSetter=0.0, isSpaceFilling=True,),
        ColumnDefn("date", 'center', 80, 'date', valueSetter=wx.DateTime.FromDMY(1, 0, 1900), isSpaceFilling=True,
                   stringConverter=xformat.FmtDate),
        ColumnDefn("choice", 'center', 40, 'choice', valueSetter='mon item',choices=['CHQ','VRT','ESP'], isSpaceFilling=True,
                   )
    ]
    dicOlv = {'lstColonnes': liste_Colonnes,
              'getDonnees': GetDonnees,
              'recherche': True,
              'checkColonne': True,
Esempio n. 15
0
def GetOlvColonnes(dlg):
    # retourne la liste des colonnes de l'écran principal
    return [
        ColumnDefn("Date",
                   'center',
                   85,
                   'date',
                   valueSetter=wx.DateTime.Today(),
                   isSpaceFilling=False,
                   stringConverter=xformat.FmtDate),
        ColumnDefn("Cpt No",
                   'left',
                   90,
                   'compte',
                   valueSetter='',
                   isSpaceFilling=False,
                   isEditable=True),
        ColumnDefn("Cpt Appel",
                   'left',
                   90,
                   'appel',
                   valueSetter='',
                   isSpaceFilling=False,
                   isEditable=False),
        ColumnDefn("Cpt Libellé ",
                   'left',
                   150,
                   'libcpt',
                   valueSetter='',
                   isSpaceFilling=False,
                   isEditable=False),
        ColumnDefn(
            "Mode",
            'centre',
            70,
            'mode',
            valueSetter='',
            isSpaceFilling=False,
        ),
        ColumnDefn("NoPièce", 'left', 80, 'noPiece', isSpaceFilling=False),
        ColumnDefn("Libelle",
                   'left',
                   200,
                   'libelle',
                   valueSetter='',
                   isSpaceFilling=True),
        ColumnDefn("Montant",
                   'right',
                   90,
                   "montant",
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal),
        ColumnDefn("Nature",
                   'left',
                   200,
                   'nature',
                   valueSetter='',
                   isSpaceFilling=True,
                   isEditable=False)
    ]
Esempio n. 16
0
        [3, "Java", 57.08, 219,
         wx.DateTime.FromDMY(1, 0, 1900), ''],
        [98, "langage C", 10000, 209,
         wx.DateTime.FromDMY(1, 0, 1900), ''],
    ]
    donneesFiltrees = [x for x in donnees if filtre.upper() in x[1].upper()]
    return donneesFiltrees


import xpy.outils.xformat as xfmt

liste_Colonnes = [
    ColumnDefn(
        "clé",
        'left',
        10,
        "cle",
        valueSetter=1,
        isSpaceFilling=True,
    ),
    ColumnDefn("mot d'ici", 'left', 200, "mot", valueSetter=''),
    ColumnDefn("nbre",
               'right',
               -1,
               "nombre",
               isSpaceFilling=True,
               valueSetter=0.0,
               stringConverter=xfmt.FmtDecimal),
    ColumnDefn("prix",
               'left',
               80,
               "prix",
Esempio n. 17
0
def GetOlvColonnes(dlg):
    # retourne la liste des colonnes de l'écran principal
    return [
            ColumnDefn("IDconso", 'centre', 0, 'IDconso',
                       isEditable=False),
            ColumnDefn("IDvehicule", 'centre', 50, 'idvehicule', isEditable=True),
            ColumnDefn("Véhicule", 'center', 90, 'vehicule', isSpaceFilling=False,isEditable=False),
            ColumnDefn("Type Tiers", 'center', 40, 'typetiers', isSpaceFilling=False,valueSetter='A',
                       cellEditorCreator=CellEditor.ChoiceEditor,
                       choices=['A activité','T tiers','P partenaire','S structure']),
            ColumnDefn("Activité", 'center', 60, 'idactivite', isSpaceFilling=False),
            ColumnDefn("Nom tiers/activité", 'left', 100, 'nomtiers',
                       isSpaceFilling=True, isEditable=False),
            ColumnDefn("Date Deb", 'center', 85, 'datekmdeb',
                       stringConverter=xformat.FmtDate, isSpaceFilling=False),
            ColumnDefn("KM début", 'right', 90, 'kmdeb', isSpaceFilling=False,valueSetter=0,
                       stringConverter=xformat.FmtInt),
            ColumnDefn("Date Fin", 'center', 85, 'datekmfin',
                       stringConverter=xformat.FmtDate, isSpaceFilling=False),
            ColumnDefn("KM fin", 'right', 90, 'kmfin', isSpaceFilling=False,valueSetter=0,
                       stringConverter=xformat.FmtInt),
            ColumnDefn("KM conso", 'right', 80, 'conso', isSpaceFilling=False,valueSetter=0,
                       stringConverter=xformat.FmtInt, isEditable=False),
            ColumnDefn("Observation", 'left', 150, 'observation',
                       isSpaceFilling=True),
            ]
Esempio n. 18
0
def DefColonnes(lstNoms, lstCodes, lstValDef, lstLargeur):
    from xpy.outils.ObjectListView import ColumnDefn
    # Composition d'une liste de définition de colonnes d'un OLV; remarque faux ami: 'nom, code' == 'label, name'
    ix = 0
    # normalise les len() des listes en ajoutant des items
    for lst in (lstCodes, lstValDef, lstLargeur):
        if lst == None: lst = []
        if len(lst) < len(lstNoms):
            lst.extend([''] * (len(lstNoms) - len(lst)))

    lstColonnes = []
    yaSpaceFil = False

    for colonne in lstNoms:
        if isinstance(lstValDef[ix], (str, wx.DateTime, datetime.date)):
            posit = 'left'
        elif isinstance(lstValDef[ix], bool):
            #posit = 'centre'
            posit = 'left'
        else:
            posit = 'right'
        # ajoute un converter à partir de la valeur par défaut
        if isinstance(lstValDef[ix], (float, )):
            if '%' in colonne:
                stringConverter = FmtPercent
            else:
                stringConverter = FmtDecimal
        elif isinstance(lstValDef[ix], bool):
            if lstValDef[ix] == False:
                # le false est à blanc True:'X'
                stringConverter = FmtBoolX
            else:
                # le false est 'N' le True 'O'
                stringConverter = FmtBool
        elif isinstance(lstValDef[ix], int):
            if '%' in colonne:
                stringConverter = FmtPercent
            else:
                stringConverter = FmtIntNoSpce
        elif isinstance(lstValDef[ix], (datetime.date, wx.DateTime)):
            stringConverter = FmtDate
        elif lstCodes[ix][:3] == 'tel' and isinstance(lstValDef[ix], (str)):
            # téléphone repéré par tel dans le début du code
            stringConverter = FmtTelephone
        else:
            stringConverter = None
        if lstLargeur[ix] in ('', None, 'None', -1):
            lstLargeur[ix] = -1
            isSpaceFilling = True
            yaSpaceFil = True
        else:
            isSpaceFilling = False
        code = lstCodes[ix]
        lstColonnes.append(
            ColumnDefn(title=colonne,
                       align=posit,
                       width=lstLargeur[ix],
                       valueGetter=code,
                       valueSetter=lstValDef[ix],
                       isSpaceFilling=isSpaceFilling,
                       stringConverter=stringConverter))
        ix += 1
    if not yaSpaceFil:
        maxW = 0
        ixMax = None
        # si aucun space Filling, on active sur la plus large
        for col in lstColonnes:
            if col.width > maxW:
                maxW = col.width
                ixMax = lstColonnes.index(col)
        if not ixMax == None:
            lstColonnes[ixMax].isSpaceFilling = True
    return lstColonnes
Esempio n. 19
0
                {'name': 'modifier',
                    'help': "Modifier les propriétés de la ligne selectionnée",
                    'size': (25, 25), 
                    'image': wx.Bitmap("xpy/Images/16x16/Modifier.png", wx.BITMAP_TYPE_ANY),
                    'onBtn': pnl.OnModifier},
                {'name': 'supprimer',
                 'help': "Supprimer la ligne selectionnée",
                 'size': (25, 25),
                 'image': wx.Bitmap("xpy/Images/16x16/Supprimer.png", wx.BITMAP_TYPE_ANY),
                 'onBtn': pnl.OnSupprimer},
            ]

# paramètre les options de l'OLV
DICOLV = {
    'lstColonnes': [
                ColumnDefn("IDimmo", 'centre', 0, 'IDimmo'),
                ColumnDefn("IDcomposant", 'centre', 0, 'IDcomposant'),
                ColumnDefn("Cpte Immo", 'centre', 80, 'compteimmo'),
                ColumnDefn("Cpte Dot", 'center', 70, 'cptedot', ),
                ColumnDefn("Section", 'left', 60, 'section'),
                ColumnDefn("MiseEnServ", 'center', 80, 'miseenservice',
                           stringConverter=xformat.FmtDate,),
                ColumnDefn("Ensemble", 'center', 120, 'enemble', isSpaceFilling=True),
                ColumnDefn("Etat", 'left', 30, 'etat'),
                ColumnDefn("Composant", 'center', 120, 'composant', isSpaceFilling=True),
                ColumnDefn("Valeur", 'right', 90, 'valeur', valueSetter=0,
                           stringConverter=xformat.FmtDecimal),
                ColumnDefn("Amo", 'center', 40, 'typeamo'),
                ColumnDefn("Taux", 'right', 50, 'taux', valueSetter=0,
                           stringConverter=xformat.FmtPercent),
                ColumnDefn("Amo Antér.", 'right', 90, 'ante', valueSetter=0,
Esempio n. 20
0
def GetDicOlv(dlg):
    return {
        'lstColonnes': [
            ColumnDefn("Compte", 'centre', 90, 'IDcompte'),
            ColumnDefn("Section", 'left', 60, 'section', valueSetter=''),
            ColumnDefn("Libellé du compte",
                       'left',
                       150,
                       'label',
                       isSpaceFilling=True),
            ColumnDefn("Débits",
                       'right',
                       90,
                       'debit',
                       valueSetter=0,
                       stringConverter=xformat.FmtDecimal),
            ColumnDefn("Crédits",
                       'right',
                       90,
                       'credit',
                       valueSetter=0,
                       stringConverter=xformat.FmtDecimal),
            ColumnDefn("Solde",
                       'right',
                       90,
                       'solde',
                       valueSetter=0,
                       stringConverter=xformat.FmtDecimal),
        ],
        'dictColFooter': {
            'label': {
                "mode": "nombre",
                "alignement": wx.ALIGN_CENTER,
                'pluriel': "lignes"
            },
            'debit': {
                "mode": "total",
                "alignement": wx.ALIGN_RIGHT
            },
            'credit': {
                "mode": "total",
                "alignement": wx.ALIGN_RIGHT
            },
            'solde': {
                "mode": "total",
                "alignement": wx.ALIGN_RIGHT
            },
        },
        'getDonnees':
        dlg.GetDonnees,
        'lstChamps': ['Numero', 'Intitule', 'Debit', 'Credit'],
        'minSize': (600, 200),
        'sortColumnIndex':
        0,
        'sortAscending':
        True,
        'checkColonne':
        False,
        'recherche':
        True,
        'editMode':
        False,
        'msgIfEmpty':
        "Aucune écriture trouvée !",
    }
Esempio n. 21
0
        xgtr.DLG_tableau.__init__(self,parent,dicOlv)

# -- pour tests -----------------------------------------------------------------------------------------------------

def GetDonnees(matriceOlv={},filtre = ""):
    donnees = [
                [None,wx.DateTime.FromDMY(15, 11, 2018),'2019-04-09',"Bonjour", -30.05939, -10.05939, 0.0,],
                [None, wx.DateTime.FromDMY(18, 3, 2019), '20/06/2019', "jourwin", 12045.039, 1293.9, 20.40, ],
                [None, wx.DateTime.FromDMY(18, 3, 2019), '2019-06-20', "sqljourbon", 11/3, 5/7, 0, ],
                [None, wx.DateTime.FromDMY(1, 5, 2018), '2019-05-30', "bye", 25.1, 25.1, 0.0, ],
    ]
    donneesFiltrees = [x for x in donnees if filtre.upper() in x[3].upper() ]
    return donneesFiltrees

liste_Colonnes = [
    ColumnDefn("clé", 'left', 60, "zero",valueSetter=1,isSpaceFilling =False,isEditable=False),
    ColumnDefn("date", 'center', 80, "date",valueSetter=wx.DateTime.FromDMY(1,0,1900),isSpaceFilling = True,
               stringConverter=xformat.FmtDate,isEditable=False),
    ColumnDefn("date SQL", 'center', 80, "datesql", valueSetter='2000-01-01',isSpaceFilling = True,
               stringConverter=xformat.FmtDate,isEditable=False),
    ColumnDefn("mot d'ici", 'left', 200, "mot",valueSetter=0.0,
               isEditable=False,),
    ColumnDefn("montant", 'right', 80, "montant", valueSetter=0.0,isSpaceFilling=True,
               stringConverter=xformat.FmtMontant,isEditable=False,),
    ColumnDefn("à régler", 'right', 80, "reste",valueSetter=0.0,isSpaceFilling=True,
               stringConverter=xformat.FmtMontant,isEditable=False),
    ColumnDefn("Affecté", 'right', 80, "affecte", valueSetter=0.0, isSpaceFilling=True,
               stringConverter=xformat.FmtMontant,cellEditorCreator=CellEditor.FloatEditor),
    ]
dicOlv = {'listeColonnes':liste_Colonnes,
                'getDonnees':GetDonnees,
Esempio n. 22
0
def GetOlvColonnes(dlg):
    # retourne la liste des colonnes de l'écran principal, valueGetter correspond aux champ des tables ou calculs
    if dlg.sens == 'entrees':
        titlePrix = "PxParPièce"
    else:
        titlePrix = "Prix Unit."
    lstCol = [
        ColumnDefn("ID", 'centre', 0, 'IDmouvement', isEditable=False),
        ColumnDefn("Repas",
                   'left',
                   60,
                   'repas',
                   cellEditorCreator=CellEditor.ChoiceEditor),
        ColumnDefn("Article",
                   'left',
                   200,
                   'IDarticle',
                   valueSetter="",
                   isSpaceFilling=True),
        ColumnDefn("Quantité",
                   'right',
                   80,
                   'qte',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtQte),
        ColumnDefn(titlePrix,
                   'right',
                   80,
                   'pxUn',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal),
        ColumnDefn("Coût Ration",
                   'right',
                   80,
                   'pxRation',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal,
                   isEditable=False),
        ColumnDefn("Nbre Rations",
                   'right',
                   80,
                   'nbRations',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal,
                   isEditable=False),
        ColumnDefn("Mtt HT",
                   'right',
                   80,
                   'mttHT',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal,
                   isEditable=False),
        ColumnDefn("Mtt TTC",
                   'right',
                   80,
                   'mttTTC',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal,
                   isEditable=False),
        ColumnDefn("PrixStock",
                   'right',
                   80,
                   'pxMoy',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal,
                   isEditable=False),
        ColumnDefn("Qté stock",
                   'right',
                   80,
                   'qteStock',
                   isSpaceFilling=False,
                   valueSetter=0.0,
                   stringConverter=xformat.FmtDecimal,
                   isEditable=False),
    ]
    if dlg.sens == 'entrees':
        # supprime la saisie du repas
        del lstCol[1]
    if dlg.origine[:5] == 'achat':
        dlg.typeAchat = True
        for col in lstCol:
            if col.valueGetter in ('qte', 'pxUn'):
                col.isEditable = False
        lstColAchat = [
            ColumnDefn("Nb Unités",
                       'right',
                       80,
                       'nbAch',
                       isSpaceFilling=False,
                       valueSetter=0.0,
                       stringConverter=xformat.FmtDecimal,
                       isEditable=True),
            ColumnDefn("Prix unité",
                       'right',
                       80,
                       'pxAch',
                       isSpaceFilling=False,
                       valueSetter=0.0,
                       stringConverter=xformat.FmtDecimal,
                       isEditable=True),
            ColumnDefn("Qte/unité",
                       'right',
                       80,
                       'parAch',
                       isSpaceFilling=False,
                       valueSetter=1.0,
                       stringConverter=xformat.FmtQte,
                       isEditable=True),
        ]
        lstCol = lstCol[:2] + lstColAchat + lstCol[2:]
    else:
        dlg.typeAchat = False
    return lstCol