def __init__(self, parent): 
        HTL.HyperTreeList.__init__(self, parent, -1)
        self.parent = parent
        self.dictImpression = {}
        self.dictIndexColonnes = {}
        
        # Adapte taille Police pour Linux
        from Utils import UTILS_Linux
        UTILS_Linux.AdaptePolice(self)

        # Création de l'ImageList
        self.dictImages = {
            "ligne" : {"img" : wx.Bitmap(Chemins.GetStaticPath('Images/16x16/Ligne.png'), wx.BITMAP_TYPE_PNG), "index" : None, "nomFichier":"Ligne"},
            "arret" : {"img" : wx.Bitmap(Chemins.GetStaticPath('Images/16x16/Drapeau.png'), wx.BITMAP_TYPE_PNG), "index" : None, "nomFichier":"Drapeau"},
            }
        for code, valeurs in DICT_CATEGORIES.items() :
            self.dictImages[code] = {"img" : wx.Bitmap(Chemins.GetStaticPath('Images/16x16/%s.png' % valeurs["image"]), wx.BITMAP_TYPE_PNG), "index" : None, "nomFichier":valeurs["image"]}
        
        il = wx.ImageList(16, 16)
        index =0
        for code, dictImage in self.dictImages.items() :
            il.Add(dictImage["img"])
            dictImage["index"] = index
            index += 1
        self.AssignImageList(il)
        
        # Style
        self.SetBackgroundColour(wx.WHITE)
        if 'phoenix' in wx.PlatformInfo:
            TR_COLUMN_LINES = HTL.TR_COLUMN_LINES
        else :
            TR_COLUMN_LINES = wx.TR_COLUMN_LINES
        self.SetAGWWindowStyleFlag(wx.TR_HIDE_ROOT  | TR_COLUMN_LINES |wx.TR_HAS_VARIABLE_ROW_HEIGHT | wx.TR_FULL_ROW_HIGHLIGHT ) # HTL.TR_NO_HEADER
        self.EnableSelectionVista(True)
Exemplo n.º 2
0
    def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.SUNKEN_BORDER) :
        CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style)
        self.parent = parent
        self.root = self.AddRoot(_(u"Transports"))
        self.listeBranches = []
        
        self.SetBackgroundColour(wx.WHITE)
        self.SetAGWWindowStyleFlag(wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS | wx.TR_HAS_VARIABLE_ROW_HEIGHT | CT.TR_AUTO_CHECK_PARENT | CT.TR_AUTO_CHECK_CHILD)
        self.EnableSelectionVista(True)

        # Création de l'ImageList
        self.dictImages = {}
        for code, valeurs in DICT_CATEGORIES.items() :
            self.dictImages[code] = {"img" : wx.Bitmap(Chemins.GetStaticPath('Images/16x16/%s.png' % valeurs["image"]), wx.BITMAP_TYPE_PNG), "index" : None}
        
        il = wx.ImageList(16, 16)
        index =0
        for code, dictImage in self.dictImages.items() :
            il.Add(dictImage["img"])
            dictImage["index"] = index
            index += 1
        self.AssignImageList(il)

        # Binds
        self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.OnCheck)
Exemplo n.º 3
0
    def InitObjectListView(self):            
        # Couleur en alternance des lignes
        self.oddRowsBackColor = UTILS_Interface.GetValeur("couleur_tres_claire", wx.Colour(240, 251, 237))
        self.evenRowsBackColor = wx.Colour(255, 255, 255)
        self.useExpansionColumn = True
        
        # Image list
        for code, valeurs in DICT_CATEGORIES.iteritems() :
            img = self.AddNamedImages(code, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/%s.png" % valeurs["image"]), wx.BITMAP_TYPE_PNG))

        def rowFormatter(listItem, track):
            if track.actif == 0 or (track.date_debut >= datetime.date.today() and track.date_fin <= datetime.date.today()) :
                listItem.SetTextColour((180, 180, 180))

        def GetImageCategorie(track):
            return track.categorie

        def FormateDateCourt(dateDD):
            if dateDD == None :
                return ""
            else:
                return DateEngFr(str(dateDD))

        def FormateHeure(heure):
            if heure == "00:00" or heure == None : return ""
            return heure.replace(":", "h")

        def FormateCategorie(categorie):
            return DICT_CATEGORIES[categorie]["label"]

        liste_Colonnes = [
            ColumnDefn(_(u"ID"), "left", 0, "IDtransport", typeDonnee="entier"), 
            ColumnDefn(_(u"Transport"), "left", 70, "categorie", typeDonnee="texte", stringConverter=FormateCategorie,  imageGetter=GetImageCategorie),
            ColumnDefn(u"Du", 'left', 80, "date_debut", typeDonnee="date", stringConverter=FormateDateCourt),
            ColumnDefn(_(u"Au"), 'left', 80, "date_fin", typeDonnee="date", stringConverter=FormateDateCourt),
            ColumnDefn(_(u"Départ"), 'center', 50, "depart_heure", typeDonnee="texte", stringConverter=FormateHeure),
            ColumnDefn(_(u"Origine"), 'left', 110, "depart_nom", typeDonnee="texte"),
            ColumnDefn(_(u"Arrivée"), 'center', 50, "arrivee_heure", typeDonnee="texte", stringConverter=FormateHeure),
            ColumnDefn(_(u"Destination"), 'left', 110, "arrivee_nom", typeDonnee="texte"),
            ]

        if self.IDindividu == None :
            liste_Colonnes.insert(1, ColumnDefn(_(u"Individu"), "left", 150, "individu_nom_complet", typeDonnee="texte") )

        self.rowFormatter = rowFormatter
        self.SetColumns(liste_Colonnes)
        self.SetEmptyListMsg(_(u"Aucun transport programmé"))
        self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton"))
        self.SetSortColumn(self.columns[2])
        self.SetObjects(self.donnees)
Exemplo n.º 4
0
    def InitObjectListView(self):            
        # Couleur en alternance des lignes
        self.oddRowsBackColor = UTILS_Interface.GetValeur("couleur_tres_claire", wx.Colour(240, 251, 237))
        self.evenRowsBackColor = wx.Colour(255, 255, 255)
        self.useExpansionColumn = True
        
        # Image list
        for code, valeurs in DICT_CATEGORIES.iteritems() :
            img = self.AddNamedImages(code, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/%s.png" % valeurs["image"]), wx.BITMAP_TYPE_PNG))
        
        def GetImageCategorie(track):
            return track.categorie

        def FormateDateCourt(dateDD):
            if dateDD == None :
                return ""
            else:
                return DateEngFr(str(dateDD))

        def FormateDateHeure(dateDT):
            date = FormateDateCourt(datetime.date(dateDT.year, dateDT.month, dateDT.day))
            heure = U"%dh%02d" % (dateDT.hour, dateDT.minute)
            if heure == "0h00" : heure = u""
            return u"%s %s" % (date, heure)

        def FormateCategorie(categorie):
            return DICT_CATEGORIES[categorie]["label"]

        liste_Colonnes = [
            ColumnDefn(u"", "left", 0, "IDtransport", typeDonnee="entier"), 
            ColumnDefn(_(u"Transport"), "left", 70, "categorie", typeDonnee="texte", stringConverter=FormateCategorie,  imageGetter=GetImageCategorie),
            ColumnDefn(_(u"Départ"), 'left', 110, "depart_dateHeure", typeDonnee="texte", stringConverter=FormateDateHeure),
            ColumnDefn(_(u"Origine"), 'left', 120, "depart_nom", typeDonnee="texte"),
            ColumnDefn(_(u"Arrivée"), 'left', 110, "arrivee_dateHeure", typeDonnee="texte", stringConverter=FormateDateHeure),
            ColumnDefn(_(u"Destination"), 'left', 120, "arrivee_nom", typeDonnee="texte"),
            ]
        
        if self.IDindividu == None :
            liste_Colonnes.insert(1, ColumnDefn(_(u"Individu"), "left", 150, "individu_nom_complet", typeDonnee="texte") )
        self.SetColumns(liste_Colonnes)
        self.CreateCheckStateColumn(1)
        self.SetEmptyListMsg(_(u"Aucun transport"))
        self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton"))
        if self.IDindividu == None :
            self.SetSortColumn(self.columns[4])
        else :
            self.SetSortColumn(self.columns[3])
        self.SetObjects(self.donnees)
Exemplo n.º 5
0
    def InitObjectListView(self):            
        # Couleur en alternance des lignes
        self.oddRowsBackColor = UTILS_Interface.GetValeur("couleur_tres_claire", wx.Colour(240, 251, 237))
        self.evenRowsBackColor = wx.Colour(255, 255, 255)
        self.useExpansionColumn = True
        
        # Image list
        for code, valeurs in DICT_CATEGORIES.iteritems() :
            img = self.AddNamedImages(code, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/%s.png" % valeurs["image"]), wx.BITMAP_TYPE_PNG))
        
        def GetImageCategorie(track):
            return track.categorie

        def FormateDateCourt(dateDD):
            if dateDD == None :
                return ""
            else:
                return DateEngFr(str(dateDD))

        def FormateDateHeure(dateDT):
            date = FormateDateCourt(datetime.date(dateDT.year, dateDT.month, dateDT.day))
            heure = U"%dh%02d" % (dateDT.hour, dateDT.minute)
            if heure == "0h00" : heure = u""
            return u"%s %s" % (date, heure)

        def FormateCategorie(categorie):
            return DICT_CATEGORIES[categorie]["label"]

        liste_Colonnes = [
            ColumnDefn(_(u"ID"), "left", 0, "IDtransport", typeDonnee="entier"), 
            ColumnDefn(_(u"Transport"), "left", 80, "categorie", typeDonnee="texte", stringConverter=FormateCategorie,  imageGetter=GetImageCategorie),
            ColumnDefn(_(u"Départ"), 'left', 130, "depart_dateHeure", typeDonnee="texte", stringConverter=FormateDateHeure),
            ColumnDefn(_(u"Origine"), 'left', 120, "depart_nom", typeDonnee="texte"),
            ColumnDefn(_(u"Arrivée"), 'left', 130, "arrivee_dateHeure", typeDonnee="texte", stringConverter=FormateDateHeure),
            ColumnDefn(_(u"Destination"), 'left', 120, "arrivee_nom", typeDonnee="texte"),
            ]
        
        self.SetColumns(liste_Colonnes)
        self.SetEmptyListMsg(_(u"Aucun transport"))
        self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton"))
        self.SetSortColumn(self.columns[2])
        self.SetObjects(self.donnees)
Exemplo n.º 6
0
    def InitObjectListView(self):
        # Couleur en alternance des lignes
        self.oddRowsBackColor = UTILS_Interface.GetValeur(
            "couleur_tres_claire", wx.Colour(240, 251, 237))
        self.evenRowsBackColor = wx.Colour(255, 255, 255)
        self.useExpansionColumn = True

        # Image list
        for code, valeurs in DICT_CATEGORIES.iteritems():
            img = self.AddNamedImages(
                code,
                wx.Bitmap(
                    Chemins.GetStaticPath("Images/16x16/%s.png" %
                                          valeurs["image"]),
                    wx.BITMAP_TYPE_PNG))

        def rowFormatter(listItem, track):
            if track.actif == 0 or (track.date_debut >= datetime.date.today()
                                    and
                                    track.date_fin <= datetime.date.today()):
                listItem.SetTextColour((180, 180, 180))

        def GetImageCategorie(track):
            return track.categorie

        def FormateDateCourt(dateDD):
            if dateDD == None:
                return ""
            else:
                return DateEngFr(str(dateDD))

        def FormateHeure(heure):
            if heure == "00:00" or heure == None: return ""
            return heure.replace(":", "h")

        def FormateCategorie(categorie):
            return DICT_CATEGORIES[categorie]["label"]

        liste_Colonnes = [
            ColumnDefn(_(u"ID"), "left", 0, "IDtransport",
                       typeDonnee="entier"),
            ColumnDefn(_(u"Transport"),
                       "left",
                       70,
                       "categorie",
                       typeDonnee="texte",
                       stringConverter=FormateCategorie,
                       imageGetter=GetImageCategorie),
            ColumnDefn(u"Du",
                       'left',
                       80,
                       "date_debut",
                       typeDonnee="date",
                       stringConverter=FormateDateCourt),
            ColumnDefn(_(u"Au"),
                       'left',
                       80,
                       "date_fin",
                       typeDonnee="date",
                       stringConverter=FormateDateCourt),
            ColumnDefn(_(u"Départ"),
                       'center',
                       50,
                       "depart_heure",
                       typeDonnee="texte",
                       stringConverter=FormateHeure),
            ColumnDefn(_(u"Origine"),
                       'left',
                       110,
                       "depart_nom",
                       typeDonnee="texte"),
            ColumnDefn(_(u"Arrivée"),
                       'center',
                       50,
                       "arrivee_heure",
                       typeDonnee="texte",
                       stringConverter=FormateHeure),
            ColumnDefn(_(u"Destination"),
                       'left',
                       110,
                       "arrivee_nom",
                       typeDonnee="texte"),
        ]

        self.rowFormatter = rowFormatter
        self.SetColumns(liste_Colonnes)
        self.SetEmptyListMsg(_(u"Aucun transport programmé"))
        self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton"))
        self.SetSortColumn(self.columns[2])
        self.SetObjects(self.donnees)