def GetDefaultFont(self): """Constructs and returns a wxFont object from the settings of the default_style object. @return: font object of default style @rtype: wx.Font """ if self.HasNamedStyle('default_style'): style_item = self.GetItemByName('default_style') face = style_item.GetFace() if face[0] == u"%": face = face % self.fonts size = style_item.GetSize() if isinstance(size, basestring): size = size % self.fonts font = wx.FFont(int(size), wx.MODERN, face=face) else: font = wx.FFont(self.fonts[self.FONT_SIZE], wx.MODERN) return font
def InitObjectListView(self): def FormateNumero(numero): return "%06d" % numero def FormateDate(dateDD): if dateDD == None: return u"" return DateEngFr(str(dateDD)) def FormateMontant(montant): if montant == None or montant == "": return "" return u"%.2f %s" % (montant, SYMBOLE) def rowFormatter(listItem, track): if track.valide == False: listItem.SetTextColour(wx.Colour(150, 150, 150)) # Couleur en alternance des lignes self.oddRowsBackColor = UTILS_Interface.GetValeur( "couleur_tres_claire", wx.Colour(240, 251, 237)) self.evenRowsBackColor = "#FFFFFF" # Vert # Paramètres ListView self.useExpansionColumn = True # Version pour liste reçus self.SetColumns([ ColumnDefn(u"", "left", 0, "IDrecu", typeDonnee="entier"), ColumnDefn(_(u"Date"), "left", 70, "date_edition", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Numéro"), "centre", 60, "numero", typeDonnee="entier", stringConverter=FormateNumero), ColumnDefn(_(u"Famille"), "left", 180, "nomsTitulaires", typeDonnee="texte"), ColumnDefn(_(u"IDreglement"), "centre", 75, "IDreglement", typeDonnee="entier"), ]) self.SetSortColumn(self.columns[1]) self.SetEmptyListMsg(_(u"Aucun reçu de règlement")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) ## self.rowFormatter = rowFormatter self.SetObjects(self.donnees)
def get_representative_per_obj(self, parent): panel = wx.Panel(parent) sizer = wx.BoxSizer(wx.VERTICAL) grid = wx.FlexGridSizer(cols=3) sizer_lb1 = wx.BoxSizer(wx.VERTICAL) lb1_label = wx.StaticText(panel, -1, L('HIGHER_VALUES')) pts = lb1_label.GetFont().GetPointSize() lb1_label.SetFont(wx.FFont(pts, wx.SWISS, wx.FONTFLAG_BOLD)) self.lb1_label = lb1_label self.lb1 = wx.CheckListBox(panel, choices=self.data.max_objetives, size=(100, 160)) self.lb1.Bind(wx.EVT_CHECKLISTBOX, self.on_lb1) sizer_lb1.Add(lb1_label, flag=wx.ALL, border=2) sizer_lb1.Add(self.lb1, flag=wx.ALL | wx.EXPAND, border=5) sizer_lb2 = wx.BoxSizer(wx.VERTICAL) lb2_label = wx.StaticText(panel, -1, L('SMALLER_VALUES')) pts = lb2_label.GetFont().GetPointSize() lb2_label.SetFont(wx.FFont(pts, wx.SWISS, wx.FONTFLAG_BOLD)) self.lb2_label = lb2_label self.lb2 = wx.CheckListBox(panel, choices=self.data.max_objetives, size=(100, 160)) self.lb2.Bind(wx.EVT_CHECKLISTBOX, self.on_lb2) sizer_lb2.Add(lb2_label, flag=wx.ALL, border=2) sizer_lb2.Add(self.lb2, flag=wx.ALL | wx.EXPAND, border=5) _style = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL grid.Add(sizer_lb1, 0, _style, 5) grid.Add(wx.StaticLine(panel, wx.ID_ANY, style=wx.LI_VERTICAL), 0, wx.ALL | wx.EXPAND, 5) _style = wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALL grid.Add(sizer_lb2, 0, _style, 5) sizer.Add(grid, 1, wx.EXPAND | wx.ALL, 10) panel.SetSizer(sizer) return panel
def get_module_gui_font(module, default_to_None=False): default, (face, size, use_in_gui) = get_module_font_params(module) if use_in_gui: font = wx.FFont(size, wx.FONTFAMILY_ROMAN, face=face) else: if default_to_None: font = None else: font = wx.NORMAL_FONT return font #use_in_gui, font
def __init__(self, parent): wx.Notebook.__init__(self, parent, size=(450, 400)) # Attributes self.doc = html.HtmlWindow(self) self.code = PythonStc(self) # Setup self.AddPage(self.doc, "Info") self.AddPage(self.code, "Demo Code") self.doc.SetFont(wx.FFont(12, wx.MODERN))
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 # Préparation de la listeImages imgDefaut = self.AddNamedImages( "defaut", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok.png"), wx.BITMAP_TYPE_PNG)) def FormateDate(dateDD): if dateDD == None: return u"" return UTILS_Dates.DateEngFr(str(dateDD)) liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDreleve", typeDonnee="entier"), ColumnDefn(_(u"Nom"), 'left', 200, "nom", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Date début"), "left", 100, "date_debut", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Date fin"), "left", 100, "date_fin", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Compte bancaire"), "left", 200, "nomCompteBancaire", typeDonnee="texte"), ColumnDefn(_(u"Nbre opérations"), "center", 100, "nbreOperations", typeDonnee="entier"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun relevé bancaire")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="Tekton")) self.SetSortColumn(self.columns[2]) self.SetObjects(self.donnees)
def test_fontProperties(self): f = wx.FFont(18, wx.FONTFAMILY_SWISS) f.Encoding f.FaceName f.Family f.NativeFontInfoDesc f.NativeFontInfoUserDesc f.PointSize f.PixelSize f.Style f.Weight
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 liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDfamille", typeDonnee="entier"), ColumnDefn(_(u"Famille"), 'left', 250, "nomTitulaires", typeDonnee="texte"), ColumnDefn(_(u"Rue"), "left", 160, "rue", typeDonnee="texte"), ColumnDefn(_(u"C.P."), "left", 45, "cp", typeDonnee="texte"), ColumnDefn(_(u"Ville"), "left", 120, "ville", typeDonnee="texte"), ColumnDefn(_(u"Secteur"), "left", 100, "secteur", typeDonnee="texte"), ColumnDefn(_(u"Régime"), "left", 130, "regime", typeDonnee="texte"), ColumnDefn(_(u"Caisse"), "left", 130, "caisse", typeDonnee="texte"), ColumnDefn(_(u"Numéro Alloc."), "left", 120, "numAlloc", typeDonnee="texte"), ] # Insertion des champs infos de base individus listeChamps = self.infosIndividus.GetNomsChampsPresents(mode="famille") for nomChamp in listeChamps: typeDonnee = UTILS_Infos_individus.GetTypeChamp(nomChamp) liste_Colonnes.append( ColumnDefn(nomChamp, "left", 100, nomChamp, typeDonnee=typeDonnee, visible=False)) self.SetColumns2(colonnes=liste_Colonnes, nomListe="OL_Liste_familles") self.SetEmptyListMsg(_(u"Aucune famille")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="Tekton")) if len(self.columns) > 1: self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
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 def FormateDateCourt(dateDD): if dateDD == None : return "" else: return UTILS_Dates.DateEngFr(str(dateDD)) def Formate_forfait(forfait): if forfait == 1: return "Forfait non verrouillé" if forfait == 2: return "Forfait verrouillé" return "" def FormateEtat(etat): if etat == "reservation": return _(u"Réservation") if etat == "attente": return _(u"Attente") if etat == "refus": return _(u"Refus") if etat == "present": return _(u"Présent") if etat == "absentj": return _(u"Absence justifiée") if etat == "absenti": return _(u"Absence injustifiée") def FormateMontant(montant): if montant == None : return u"" return u"%.2f %s" % (montant, SYMBOLE) liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDconso", typeDonnee="entier"), ColumnDefn(_(u"Date"), 'left', 90, "date", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Activité"), 'left', 120, "nom_activite", typeDonnee="texte"), ColumnDefn(_(u"Unité"), 'left', 100, "nom_unite", typeDonnee="texte"), ColumnDefn(_(u"Etat"), 'left', 100, "etat", typeDonnee="texte", stringConverter=FormateEtat), ColumnDefn(_(u"Groupe"), 'left', 100, "nom_groupe", typeDonnee="texte"), ColumnDefn(_(u"Nom"), 'left', 120, "nom", typeDonnee="texte"), ColumnDefn(_(u"Prénom"), 'left', 120, "prenom", typeDonnee="texte"), ColumnDefn(_(u"Famille"), 'left', 160, "nomTitulaires", typeDonnee="texte"), ColumnDefn(_(u"Date de saisie"), 'left', 90, "date", typeDonnee="date_saisie", stringConverter=FormateDateCourt), ColumnDefn(_(u"Début"), 'left', 60, "heure_debut", typeDonnee="texte"), ColumnDefn(_(u"Fin"), 'left', 60, "heure_fin", typeDonnee="texte"), ColumnDefn(_(u"Forfait"), 'left', 100, "forfait", typeDonnee="texte", stringConverter=Formate_forfait), ColumnDefn(_(u"Evénement"), 'left', 110, "evenement", typeDonnee="texte"), ColumnDefn(_(u"IDprestation"), "left", 80, "IDprestation", typeDonnee="entier"), ColumnDefn(_(u"Label prestation"), 'left', 140, "label_prestation", typeDonnee="texte"), ColumnDefn(_(u"Montant prestation"), 'left', 120, "montant_prestation", typeDonnee="montant", stringConverter=FormateMontant), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune consommation")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SortBy(1) self.SetObjects(self.donnees)
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 def rowFormatter(listItem, track): if track.archive == True: listItem.SetTextColour((180, 180, 180)) def FormateHorodatage(horodatage): return horodatage.strftime("%d/%m/%Y %H:%M:%S") def FormateTailleFichier(taille): return FonctionsPerso.Formate_taille_octets(taille) liste_Colonnes = [ ColumnDefn(_(u"Date génération"), "left", 130, "horodatage", typeDonnee="dateheure", stringConverter=FormateHorodatage), ColumnDefn(_(u"Appareil (ID)"), "left", 130, "appareil", typeDonnee="texte"), ColumnDefn(_(u"Contenu du fichier"), "left", 285, "detail_actions", typeDonnee="texte"), ColumnDefn(_(u"Nom du fichier"), "left", 285, "nom_fichier", typeDonnee="texte"), ColumnDefn(_(u"Taille"), "left", 70, "taille_fichier", typeDonnee="entier", stringConverter=FormateTailleFichier), ] self.rowFormatter = rowFormatter self.SetColumns(liste_Colonnes) self.CreateCheckStateColumn(0) self.SetEmptyListMsg(_(u"Aucun fichier")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def _initLayout(self): self._sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self._sizer) self.HintsLabel = wx.StaticText(self, style=wx.ALIGN_CENTER) self.HintsLabel.SetLabel("123456789") self.HintsLabel.SetFont( wx.FFont(8, wx.FONTFAMILY_DEFAULT, face="Arial")) self._sizer.Add(self.HintsLabel, 0, flag=wx.ALIGN_CENTER) self.TextBox = wx.TextCtrl(self, style=wx.TE_PROCESS_ENTER | wx.NO_BORDER | wx.TE_CENTRE) self.TextBox.SetFont( wx.FFont(16, wx.FONTFAMILY_DEFAULT, face="Arial", flags=wx.FONTFLAG_BOLD)) self.TextBox.SetBackgroundColour(self.GetBackgroundColour()) self.TextBox.Bind(wx.EVT_KEY_DOWN, self.OnKey) self.TextBox.Bind(wx.EVT_TEXT_ENTER, self.OnChange) self.TextBox.Bind(wx.EVT_KILL_FOCUS, self.OnChange) self._sizer.Add(self.TextBox, 1, flag=wx.ALIGN_CENTER | wx.EXPAND)
def InitObjectListView(self): # ImageList self.imgVert = self.AddNamedImages("vert", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ventilation_vert.png"), wx.BITMAP_TYPE_PNG)) self.imgRouge = self.AddNamedImages("rouge", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ventilation_rouge.png"), wx.BITMAP_TYPE_PNG)) self.imgOrange = self.AddNamedImages("orange", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ventilation_orange.png"), wx.BITMAP_TYPE_PNG)) ## def GetImageSoldeActuel(track): ## if track.soldeActuel == 0.0 : ## return self.imgVert ## if track.soldeActuel < 0.0 and track.soldeActuel != -track.total : ## return self.imgOrange ## return self.imgRouge def FormateNumero(numero): return "%06d" % numero def FormateDate(dateDD): if dateDD == None : return u"" return DateEngFr(str(dateDD)) def FormateMontant(montant): if montant == None or montant == "" : return "" return u"%.2f %s" % (montant, SYMBOLE) def rowFormatter(listItem, track): if track.valide == False : listItem.SetTextColour(wx.Colour(150, 150, 150)) # Couleur en alternance des lignes self.oddRowsBackColor = UTILS_Interface.GetValeur("couleur_tres_claire", wx.Colour(240, 251, 237)) self.evenRowsBackColor = "#FFFFFF" # Vert # Paramètres ListView self.useExpansionColumn = True # Version pour liste factures générale self.SetColumns([ ColumnDefn(u"", "left", 0, "IDfacture", typeDonnee="entier"), ColumnDefn(_(u"Date"), "left", 70, "date_edition", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Numéro"), "centre", 60, "numero", typeDonnee="entier", stringConverter=FormateNumero), ColumnDefn(_(u"Famille"), "left", 180, "nomsTitulaires", typeDonnee="texte"), ColumnDefn(_(u"Date début"), "centre", 75, "date_debut", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Date fin"), "centre", 75, "date_fin", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Total"), "right", 65, "total", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Réglé"), "right", 65, "regle", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Solde"), "right", 65, "solde", typeDonnee="montant", stringConverter=FormateMontant), ]) self.SetSortColumn(self.columns[1]) self.SetEmptyListMsg(_(u"Aucune attestation de présence")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) ## self.rowFormatter = rowFormatter self.SetObjects(self.donnees)
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 def FormateDateLong(dateDD): return DateComplete(dateDD) def FormateDateCourt(dateDD): if dateDD == None : return "" else: return DateEngFr(str(dateDD)) def FormateMontant(montant): if montant == None : return u"" return u"%.2f %s" % (montant, SYMBOLE) def rowFormatter(listItem, track): if track.valide == False : listItem.SetTextColour((180, 180, 180)) if self.IDfamille == None : # Version MODELES liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDaide", typeDonnee="entier"), ColumnDefn(u"Du", 'left', 75, "date_debut", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Au"), 'left', 75, "date_fin", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Nom"), 'left', 160, "nom", typeDonnee="texte"), ColumnDefn(_(u"Activité"), 'left', 60, "nom_activite", typeDonnee="texte"), ColumnDefn(_(u"Caisse"), 'left', 140, "nom_caisse", typeDonnee="texte"), ] else: # Version FAMILLE liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDaide", typeDonnee="entier"), ColumnDefn(u"Du", 'left', 75, "date_debut", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Au"), 'left', 75, "date_fin", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Nom"), 'left', 130, "nom", typeDonnee="texte"), ColumnDefn(_(u"Activité"), 'left', 60, "nom_activite", typeDonnee="texte"), ColumnDefn(_(u"Caisse"), 'left', 80, "nom_caisse", typeDonnee="texte"), ColumnDefn(_(u"Bénéficiaires"), 'left', 130, "texteBeneficiaires", typeDonnee="texte"), ColumnDefn(_(u"Total des déductions"), 'left', 140, "texte_montant_max", typeDonnee="texte"), ColumnDefn(_(u"Nbre de dates"), 'left', 130, "texte_dates_max", typeDonnee="texte"), ] self.rowFormatter = rowFormatter self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune aide journalière")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
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 def FormateDateLong(dateDD): return DateComplete(dateDD) def FormateDateCourt(dateDD): if dateDD == None: return "" else: return DateEngFr(str(dateDD)) def FormateMontant(montant): if montant == None: return u"" return u"%.2f %s" % (montant, SYMBOLE) liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDdeduction", typeDonnee="entier"), ColumnDefn(_(u"Date"), 'centre', 160, "date", typeDonnee="date", stringConverter=FormateDateLong), ColumnDefn(_(u"Individu"), 'centre', 90, "prenomIndividu", typeDonnee="texte"), ColumnDefn(_(u"Montant"), 'centre', 70, "montant", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Label"), 'left', 160, "label", typeDonnee="texte"), ColumnDefn(_(u"Prestation"), 'left', 300, "textePrestation", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune déduction")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def test_lib_stattext1(self): pnl = wx.Panel(self.frame) w = wx.lib.stattext.GenStaticText(pnl, label="This is a test", pos=(10,10)) bs1 = w.GetEffectiveMinSize() w.SetLabel("This is a New Label") w.SetFont(wx.FFont(16, wx.FONTFAMILY_ROMAN)) bs2 = w.GetEffectiveMinSize() self.assertEqual(w.GetLabel(), "This is a New Label") self.assertEqual(w.Label, "This is a New Label") self.assertTrue(bs2.height > bs1.height)
def InitObjectListView(self): # Création du imageList for categorie, civilites in Civilites.LISTE_CIVILITES : for IDcivilite, CiviliteLong, CiviliteAbrege, nomImage, genre in civilites : indexImg = self.AddNamedImages(nomImage, wx.Bitmap(Chemins.GetStaticPath("Images/16x16/%s" % nomImage), wx.BITMAP_TYPE_PNG)) def GetImageCivilite(track): return track.nomImage def FormateDate(dateStr): if dateStr == "" or dateStr == None : return "" date = str(datetime.date(year=int(dateStr[:4]), month=int(dateStr[5:7]), day=int(dateStr[8:10]))) text = str(date[8:10]) + "/" + str(date[5:7]) + "/" + str(date[:4]) return text def FormateAge(age): if age == None : return "" return _(u"%d ans") % age # 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 liste_Colonnes = [ ColumnDefn(u"", "left", 22, "IDindividu", typeDonnee="entier", imageGetter=GetImageCivilite), ColumnDefn(_(u"Nom"), 'left', 100, "nom", typeDonnee="texte"), ColumnDefn(_(u"Prénom"), "left", 100, "prenom", typeDonnee="texte"), ColumnDefn(_(u"Date naiss."), "left", 72, "date_naiss", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Genre"), "left", 50, "genre", typeDonnee="texte"), ColumnDefn(_(u"Age"), "left", 50, "age", typeDonnee="entier", stringConverter=FormateAge), ColumnDefn(_(u"Rue"), "left", 150, "rue_resid", typeDonnee="texte"), ColumnDefn(_(u"C.P."), "left", 50, "cp_resid", typeDonnee="texte"), ColumnDefn(_(u"Ville"), "left", 120, "ville_resid", typeDonnee="texte"), ColumnDefn(_(u"Tél. domicile"), "left", 100, "tel_domicile", typeDonnee="texte"), ColumnDefn(_(u"Tél. mobile"), "left", 100, "tel_mobile", typeDonnee="texte"), ColumnDefn(_(u"Email"), "left", 150, "mail", typeDonnee="texte"), ] # Insertion des champs infos de base individus listeChamps = self.infosIndividus.GetNomsChampsPresents(mode="individu") for nomChamp in listeChamps : typeDonnee = UTILS_Infos_individus.GetTypeChamp(nomChamp) liste_Colonnes.append(ColumnDefn(nomChamp, "left", 100, nomChamp, typeDonnee=typeDonnee, visible=False)) self.SetColumns2(colonnes=liste_Colonnes, nomListe="OL_Liste_individus") self.SetEmptyListMsg(_(u"Aucun individu")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) if len(self.columns) > 1 : self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def fmtMinimal(self, headerFontName="Arial", rowFontName="Times New Roman"): """ Return a minimal format for a report """ fmt = olvLib.ReportFormat() fmt.AlwaysCenterColumnHeader = True fmt.IsShrinkToFit = True fmt.CanCellsWrap = True fmt.PageHeader.Font = wx.FFont(12, wx.FONTFAMILY_DEFAULT, face=headerFontName) fmt.PageHeader.Line(wx.BOTTOM, wx.BLACK, 1, space=5) fmt.PageHeader.Padding = (0, 0, 0, 12) fmt.ListHeader.Font = wx.FFont(18, wx.FONTFAMILY_DEFAULT, face=headerFontName) fmt.ListHeader.Padding = (0, 12, 0, 12) fmt.ListHeader.Line(wx.BOTTOM, wx.BLACK, 1, space=5) fmt.GroupTitle.Font = wx.FFont(12, wx.FONTFAMILY_DEFAULT, face=headerFontName) fmt.GroupTitle.Padding = (0, 12, 0, 12) fmt.GroupTitle.Line(wx.BOTTOM, wx.BLACK, 1, space=5) fmt.PageFooter.Font = wx.FFont(10, wx.FONTFAMILY_DEFAULT, face=headerFontName) fmt.PageFooter.Line(wx.TOP, wx.BLACK, 1, space=3) fmt.PageFooter.Padding = (0, 16, 0, 0) fmt.ColumnHeader.Font = wx.FFont(14, wx.FONTFAMILY_DEFAULT, wx.FONTFLAG_BOLD, face=headerFontName) fmt.ColumnHeader.Padding = (0, 12, 0, 12) fmt.ColumnHeader.CellPadding = 5 fmt.ColumnHeader.Line(wx.BOTTOM, wx.Colour(192, 192, 192), 1, space=3) fmt.Row.Font = wx.FFont(10, wx.FONTFAMILY_DEFAULT, face=rowFontName) fmt.Row.CellPadding = 5 fmt.Row.Line(wx.BOTTOM, wx.Colour(192, 192, 192), 1, space=3) return fmt
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 # Préparation de la listeImages imgOk = self.AddNamedImages("ok", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok.png"), wx.BITMAP_TYPE_PNG)) imgPasOk = self.AddNamedImages("pasok", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Interdit.png"), wx.BITMAP_TYPE_PNG)) def GetImageCreation(track): if track.date_creation_carte == None : return "pasok" else: return "ok" def GetImageDepot(track): if track.IDdepot_cotisation == None : return "pasok" else: return "ok" def FormateDate(dateDD): if dateDD == None : return "" if dateDD == "2999-01-01" : return _(u"Illimitée") date = str(dateDD) text = str(date[8:10]) + "/" + str(date[5:7]) + "/" + str(date[:4]) return text def rowFormatter(listItem, track): if track.valide == False : listItem.SetTextColour((180, 180, 180)) liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDcotisation", typeDonnee="entier"), ColumnDefn(u"Du", 'left', 70, "date_debut", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"au"), 'left', 70, "date_fin", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Type"), 'left', 150, "typeStr", typeDonnee="texte"), ColumnDefn(_(u"Famille"), 'left', 130, "nomTitulaires", typeDonnee="texte"), ColumnDefn(_(u"Individu"), 'left', 130, "individu", typeDonnee="texte"), ColumnDefn(_(u"Nom"), 'left', 270, "nomCotisation", typeDonnee="texte"), ColumnDefn(_(u"Numéro"), 'left', 80, "numero", typeDonnee="texte"), ColumnDefn(_(u"Création carte"), 'left', 100, "date_creation_carte", typeDonnee="date", stringConverter=FormateDate, imageGetter=GetImageCreation), ColumnDefn(_(u"Activités"), 'left', 150, "activitesStr"), ColumnDefn(_(u"Notes"), 'left', 150, "observations"), ] self.SetColumns(liste_Colonnes) if self.inclus == True : self.SetEmptyListMsg(_(u"Aucune cotisation dans ce dépôt")) else: self.SetEmptyListMsg(_(u"Aucune cotisation disponible")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) ## self.SetSortColumn(self.columns[self.numColonneTri]) self.SortBy(self.numColonneTri, ascending=self.ordreAscendant) self.SetObjects(self.donnees)
def InitObjectListView(self): # Images self.imageOk = self.AddNamedImages("ok", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok.png"), wx.BITMAP_TYPE_PNG)) self.imageErreur = self.AddNamedImages("erreur", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Interdit.png"), wx.BITMAP_TYPE_PNG)) # 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 def GetImageStatut(track): if track.statut == "ok" : return self.imageOk if track.statut == "erreur" : return self.imageErreur return None def FormateHorodatage(horodatage): return horodatage.strftime("%d/%m/%Y %H:%M:%S") def Capitalize(texte): return texte.capitalize() def FormateCategorie(categorie): if categorie == "consommation" : return _(u"Consommation") if categorie == "memo_journee" : return _(u"Mémo journalier") return "?" liste_Colonnes = [ ColumnDefn(_(u"Horodatage"), "left", 130, "horodatage", typeDonnee="texte", stringConverter=FormateHorodatage), ColumnDefn(_(u"Statut"), "left", 50, "statut", typeDonnee="texte", imageGetter=GetImageStatut), ColumnDefn(_(u"Catégorie"), "left", 120, "categorie", typeDonnee="texte", stringConverter=FormateCategorie), ColumnDefn(_(u"Action"), "left", 100, "action", typeDonnee="texte", stringConverter=Capitalize), ColumnDefn(_(u"Individu"), "left", 150, "nomIndividu", typeDonnee="texte"), ColumnDefn(_(u"Détail"), "left", 300, "detail", typeDonnee="texte"), ColumnDefn(_(u"Appareil (ID)"), "left", 130, "appareil", typeDonnee="texte"), ColumnDefn(_(u"Nom du fichier"), "left", 290, "nomFichier", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.CreateCheckStateColumn(0) # Regroupement self.SetAlwaysGroupByColumn(self.index_regroupement) self.SetShowGroups(True) self.useExpansionColumn = False self.showItemCounts = False self.SetEmptyListMsg(_(u"Aucune action")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="Tekton")) self.SetSortColumn(self.columns[2]) self.SetObjects(self.donnees)
def InitObjectListView(self): # ImageList self.imageOk = self.AddNamedImages("ok", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok.png"), wx.BITMAP_TYPE_PNG)) self.imageErreur = self.AddNamedImages("erreur", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Interdit.png"), wx.BITMAP_TYPE_PNG)) def GetImageStatut(track): if track.statut == "ok" : return self.imageOk if track.statut == "erreur" : return self.imageErreur return None def FormateMontant(montant): if montant == None or montant == "" : return "" return u"%.2f %s" % (montant, SYMBOLE) def rowFormatter(listItem, track): if track.valide == False : listItem.SetTextColour(wx.Colour(150, 150, 150)) # Couleur en alternance des lignes self.oddRowsBackColor = UTILS_Interface.GetValeur("couleur_tres_claire", wx.Colour(240, 251, 237)) self.evenRowsBackColor = "#FFFFFF" # Vert # Paramètres ListView self.useExpansionColumn = True # Préparation des colonnes listeColonnes = [ ColumnDefn(u"", "left", 0, "IDindividu", typeDonnee="entier"), ColumnDefn(_(u""), "left", 20, "statut", typeDonnee="texte", imageGetter=GetImageStatut), ColumnDefn(_(u"Individu"), "left", 170, "nomCompletIndividu", typeDonnee="texte"), ColumnDefn(_(u"Famille"), "left", 250, "titulaires", typeDonnee="texte"), ColumnDefn(_(u"Catégorie de tarif"), "left", 110, "nom_categorie_tarif", typeDonnee="texte"), ColumnDefn(_(u"Montant"), "right", 80, "montant", typeDonnee="montant", stringConverter=FormateMontant), ] # Ajout des colonnes unités de conso listeUnites = [] for IDunite, dictTemp in self.dictUnitesConso.iteritems() : listeUnites.append((dictTemp["ordre"], dictTemp["nom"], dictTemp["abrege"], dictTemp["quantite"], IDunite)) listeUnites.sort() for ordre, nom, abrege, quantite, IDunite in listeUnites : listeColonnes.append(ColumnDefn(_(nom), "center", 80, "unite%d" % IDunite, typeDonnee="entier")) self.SetColumns(listeColonnes) self.CreateCheckStateColumn(1) self.SetSortColumn(self.columns[3]) self.SetEmptyListMsg(_(u"Aucun individu")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetObjects(self.donnees)
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 def FormateDate(date): return UTILS_Dates.DateDDEnFr(date) def FormateMontant(montant): if montant == None: return u"" return u"%.2f %s" % (montant, SYMBOLE) liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDcompte", typeDonnee="entier"), ColumnDefn(_(u"Numéro"), 'left', 120, "numero", typeDonnee="texte"), ColumnDefn(_(u"Nom"), 'left', 200, "nom", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Solde du jour"), "right", 100, "solde_jour", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Solde pointé"), "right", 100, "solde_pointe", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Solde final"), "right", 100, "solde", typeDonnee="montant", stringConverter=FormateMontant), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun compte bancaire")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="Tekton")) self.SetSortColumn(self.columns[2]) self.SetObjects(self.donnees)
def InitObjectListView(self): # Couleur en alternance des lignes self.useExpansionColumn = True # On définit les colonnes self.SetColumns(self.lstColonnes) if self.checkColonne: self.CreateCheckStateColumn(0) self.lstCodesColonnes = self.GetLstCodesColonnes() self.lstNomsColonnes = self.GetLstNomsColonnes() self.lstSetterValues = self.GetLstSetterValues() # On définit le message en cas de tableau vide self.SetEmptyListMsg(self.msgIfEmpty) self.SetEmptyListMsgFont(wx.FFont(11, wx.FONTFAMILY_DEFAULT))
def on_press(event, ctl=ctl, parent=self): name, size = ctl.Value.split(",") fd = wx.FontData() fd.SetInitialFont( wx.FFont(float(size), wx.FONTFAMILY_DEFAULT, face=name)) dlg = wx.FontDialog(parent, fd) if dlg.ShowModal() == wx.ID_OK: fd = dlg.GetFontData() font = fd.GetChosenFont() name = font.GetFaceName() size = font.GetPointSize() ctl.Value = "%s, %f" % (name, size)
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 # Préparation de la listeImages imgImportant = self.AddNamedImages( "attention", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Attention.png"), wx.BITMAP_TYPE_PNG)) # Formatage des données def GetImagePriorite(track): if track.priorite == "HAUTE": return imgImportant else: return None def FormateDateCourt(dateDD): if dateDD == None: return "" else: return UTILS_Dates.DateEngFr(str(dateDD)) liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDmessage", typeDonnee="entier"), ColumnDefn(_(u"Date"), 'centre', 75, "date_parution", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Catégorie"), 'left', 160, "nomCategorie", typeDonnee="texte"), ColumnDefn(_(u"Texte"), 'left', 420, "texte", typeDonnee="texte", imageGetter=GetImagePriorite, isSpaceFilling=True), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun message")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def testCalculateHeightWrapping(self): engine = ReportEngine() engine.workBounds = [0, 0, 200, 1000] engine.reportFormat.Text = fmt = BlockFormat() block = TextBlock(engine) fmt.Font = wx.FFont(12, wx.FONTFAMILY_DEFAULT, 0, "Arial") self.assertEqual(block.CalculateHeight(wx.ScreenDC()), 19) fmt.Padding = 10 self.assertEqual(block.CalculateHeight(wx.ScreenDC()), 39) fmt.Padding = (5, 10, 15, 20) self.assertEqual(block.CalculateHeight(wx.ScreenDC()), 49)
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 # Préparation de la listeImages imgDefaut = self.AddNamedImages( "defaut", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Ok.png"), wx.BITMAP_TYPE_PNG)) imgHomme = self.AddNamedImages( "homme", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Homme.png"), wx.BITMAP_TYPE_PNG)) imgFemme = self.AddNamedImages( "femme", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Femme.png"), wx.BITMAP_TYPE_PNG)) def GetImageDefaut(track): if track.defaut == 1: return "defaut" else: return None def GetImageSexe(track): if track.sexe == "H": return "homme" else: return "femme" liste_Colonnes = [ ColumnDefn(u"", "left", 21, "IDresponsable", imageGetter=GetImageDefaut), ColumnDefn(_(u"Nom du responsable"), 'left', 190, "nom", imageGetter=GetImageSexe), ColumnDefn(_(u"Fonction"), "left", 130, "fonction"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun responsable")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def OnPaint(self, evt): w,h = self.GetClientSize() dc = wx.BufferedPaintDC(self) self.PrepareDC(dc) dc.SetBackground(wx.Brush(self.GetBackgroundColour())) dc.Clear() dc.SetPen(wx.Pen("dark grey", 1)) dc.SetFont(wx.FFont(8, wx.SWISS)) y = 0 while y < SIZE+1: dc.DrawLine(0, y, w, y) dc.DrawText(str(y/UNIT), 10, y+2) y += UNIT
def __init__(self, *args, **kwds): # Récupération des paramètres perso self.itemSelected = False self.popupIndex = -1 self.listeFiltres = [] self.historique = [] self.dictTracks = {} self.dictIndividus = {} self.donnees = [] self.listeActivites = [] self.listeGroupesActivites = [] self.forceActualisation = False # Initialisation du listCtrl self.nom_fichier_liste = __file__ FastObjectListView.__init__(self, *args, **kwds) try : self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, faceName="Tekton")) except : self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetEmptyListMsg(_(u"Aucun individu")) # Binds perso self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
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 def FormateDateCourt(dateDD): if dateDD == None: return "" else: return UTILS_Dates.DateEngFr(str(dateDD)) liste_Colonnes = [ ColumnDefn(_(u"IDmodele"), "left", 0, "IDmodele", typeDonnee="entier"), ColumnDefn(u"Du", 'left', 70, "date_debut", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"au"), 'left', 70, "date_fin", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Nom"), 'left', 100, "nom", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Activité"), 'left', 200, "nomActivite", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun modèle")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
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 # ListImages for track in self.donnees: IDtexte = track.IDtexte couleur = track.couleur img = self.CreationImage(couleur) self.AddNamedImages(str(IDtexte), img) def GetImage(track): return str(track.IDtexte) def FormateJours(nbreJours): texte = _(u"%d jours") % nbreJours return texte liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDtexte", typeDonnee="entier"), ColumnDefn(_(u"Intitulé"), 'left', 200, "label", typeDonnee="texte", imageGetter=GetImage), ColumnDefn(_(u"Titre"), 'left', 180, "titre", typeDonnee="texte"), ColumnDefn(_(u"Retard Min."), 'centre', 110, "retard_min", typeDonnee="entier", stringConverter=FormateJours), ColumnDefn(_(u"Retard Max."), 'centre', 110, "retard_max", typeDonnee="entier", stringConverter=FormateJours), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun texte de rappel")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[3]) self.SetObjects(self.donnees)