def setupIngredients(self): namec = ColumnDefn('Ingredient', 'left', 200, 'name', minimumWidth=200, isSpaceFilling=True) typec= ColumnDefn('Type', 'left', 100, 'ingredient_type') use_inc = ColumnDefn('Use', 'left', 100, 'use_in', stringConverter=getUseIn) percentc = ColumnDefn('%', 'left', 100, 'percentage', stringConverter="%.2f") timec = ColumnDefn('Time', 'left', 100, 'time_used_m', stringConverter="%s") amountc = ColumnDefn('Amount', 'left', 100, 'amount_m', stringConverter="%s") namec.freeSpaceProportion = 2 self.ingredients_ctrl.oddRowsBackColor = wx.WHITE self.ingredients_ctrl.SetColumns([namec, typec, amountc, use_inc, percentc, timec])
def setProcs(self): """ Updates the ObjectListView widget display """ cw = self.col_w # change column widths as necessary if self.gui_shown: cw["name"] = self.procmonOlv.GetColumnWidth(0) cw["pid"] = self.procmonOlv.GetColumnWidth(1) cw["exe"] = self.procmonOlv.GetColumnWidth(2) cw["user"] = self.procmonOlv.GetColumnWidth(3) cw["cpu"] = self.procmonOlv.GetColumnWidth(4) cw["mem"] = self.procmonOlv.GetColumnWidth(5) cols = [ ColumnDefn("name", "left", cw["name"], "name"), ColumnDefn("pid", "left", cw["pid"], "pid"), ColumnDefn("exe location", "left", cw["exe"], "exe"), ColumnDefn("username", "left", cw["user"], "user"), ColumnDefn("cpu", "left", cw["cpu"], "cpu"), ColumnDefn("mem", "left", cw["mem"], "mem"), #ColumnDefn("description", "left", 200, "desc") ] self.procmonOlv.SetColumns(cols) self.procmonOlv.SetObjects(self.procs) self.procmonOlv.SortBy(self.sort_col) if self.currentSelection: self.procmonOlv.Select(self.currentSelection) self.procmonOlv.SetFocus() self.gui_shown = True
def InitObjectListView(self): def sizeToNiceString(byteCount): """ Convert the given byteCount into a string like: 9.9bytes/KB/MB/GB """ for (cutoff, label) in [(1024 * 1024 * 1024, "GB"), (1024 * 1024, "MB"), (1024, "KB")]: if byteCount >= cutoff: return "%.1f %s" % (byteCount * 1.0 / cutoff, label) if byteCount == 1: return "1 byte" else: return "%d bytes" % byteCount self.olv.SetColumns([ ColumnDefn("Path", "left", 150, "GetPath"), ColumnDefn("Files", "left", 100, "countFiles"), ColumnDefn("File Size", "left", 100, "sizeFiles"), ColumnDefn("Total Directories", "left", 100, "CountAllDirectories"), ColumnDefn("Total Files", "left", 100, "CountAllFiles"), ColumnDefn("Total File Size", "left", 100, "SizeAllFiles", stringConverter=sizeToNiceString), ]) self.olv.SetSortColumn(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 def FormateDateCourt(dateDD): if dateDD == None: return _(u"Jamais") else: return UTILS_Dates.DateEngFr(str(dateDD)) liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDsauvegarde", typeDonnee="entier"), ColumnDefn(_(u"Nom"), "left", 300, "nom", typeDonnee="texte"), ColumnDefn(_(u"Dernière sauvegarde"), "left", 150, "date_derniere", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Observations"), "left", 150, "observations", typeDonnee="texte", isSpaceFilling=True), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune procédure de sauvegarde")) 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 liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDligne", typeDonnee="entier"), ColumnDefn(_(u"Nom"), 'left', 430, "nom", typeDonnee="texte"), ColumnDefn(_(u"Nbre arrêts"), "center", 100, "nbreArrets", typeDonnee="entier"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune %s") % self.categorieSingulier) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def __init__(self, info_list): wx.Dialog.__init__(self, None, size=(750, 600)) self.SetTitle('Choose Run') #~ info_list = [{'description': 'Test', #~ 'creation' : '2017-07-11 08:30:00'}] panel = wx.Panel(self) self.lb = ObjectListView(self, -1, style=wx.LC_REPORT) self.lb.SetColumns([ ColumnDefn('Description', 'left', 300, 'description'), ColumnDefn('# Triangles', 'center', 150, 'num_polys'), ColumnDefn('Date/Time', 'left', 300, 'creation'), ]) self.lb.SetObjects(info_list) btn_sizer = wx.Dialog.CreateButtonSizer(self, wx.OK|wx.CANCEL) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.lb, 1, flag=wx.EXPAND) sizer.Add(btn_sizer, 0, flag=wx.EXPAND) self.SetSizer(sizer) self.lb.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick)
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 IDtype, nom, nomImage in DLG_Saisie_pb_sante.LISTE_TYPES: self.AddNamedImages( str(IDtype), wx.Bitmap(Chemins.GetStaticPath("Images/16x16/%s" % nomImage), wx.BITMAP_TYPE_PNG)) def GetImage(track): return str(track.IDtype) def rowFormatter(listItem, track): if track.valide == False: listItem.SetTextColour((180, 180, 180)) liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDprobleme", typeDonnee="entier"), ColumnDefn(_(u"Intitulé"), 'left', 360, "texteComplet", typeDonnee="texte", imageGetter=GetImage, isSpaceFilling=True), ## ColumnDefn(_(u"Nbre de jours restants"), 'left', 0, "nbreJoursRestants"), ] self.rowFormatter = rowFormatter self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune information médicale")) 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 FormateDate(dateHeureStr): dateStr, heure = dateHeureStr.split("|") return DateEngFr(dateStr) liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDaction", typeDonnee="entier"), ColumnDefn(_(u"Date"), 'center', 70, "dateHeure", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Heure"), 'center', 60, "heure", typeDonnee="texte"), ColumnDefn(_(u"Utilisateur"), 'left', 130, "nomComplet_utilisateur", typeDonnee="texte"), ColumnDefn(_(u"Famille"), 'left', 120, "nomTitulaires", typeDonnee="texte"), ColumnDefn(_(u"Individu"), 'left', 120, "nomComplet_individu", typeDonnee="texte"), ColumnDefn(_(u"Catégorie"), 'left', 150, "nomCategorie", typeDonnee="texte"), ColumnDefn(_(u"Action"), 'left', 700, "action", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun historique")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="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 liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDsecteur", typeDonnee="entier"), ColumnDefn(_(u"Nom"), "left", 290, "nom", typeDonnee="texte"), ColumnDefn(_(u"Nbre de titulaires"), "left", 110, "nbreTitulaires", typeDonnee="entier"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun secteur géographique")) 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 liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDcorrection"), ColumnDefn(_(u"Mot"), "left", 200, "mot"), ColumnDefn(_(u"Correction"), 'left', 300, "correction", isSpaceFilling=True), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune correction")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="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 liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDville", typeDonnee="entier"), ColumnDefn(_(u"Nom de la ville"), 'left', 250, "nom", typeDonnee="texte"), ColumnDefn("Code postal", "left", 120, "cp", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune ville")) 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 FormateDate(date): return UTILS_Dates.DateDDEnFr(date) liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDbudget", typeDonnee="entier"), ColumnDefn(u"Du", 'left', 80, "date_debut", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"au"), 'left', 80, "date_fin", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Nom"), 'left', 200, "nom", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Observations"), 'left', 200, "observations", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun budget")) 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 liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDcaisse", typeDonnee="entier"), ColumnDefn(_(u"Nom"), 'left', 230, "nom", typeDonnee="texte"), ColumnDefn(_(u"Régime social associé"), "left", 140, "nom_regime", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune caisse")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="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 # Image list self.imgVerrouillage = self.AddNamedImages( "verrouillage", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Cadenas_ferme.png"), wx.BITMAP_TYPE_PNG)) def FormateDate(dateDD): if dateDD == None: return u"" return UTILS_Dates.DateEngFr(str(dateDD)) def GetImageVerrouillage(track): if track.verrouillage == 1: return self.imgVerrouillage else: return None liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 42, "IDlot", typeDonnee="entier", imageGetter=GetImageVerrouillage), ColumnDefn(_(u"Nom"), "left", 290, "nom", typeDonnee="texte"), ColumnDefn(_(u"Date"), "left", 80, "date", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Nbre Prélèv."), "center", 80, "nbrePrelevements", typeDonnee="entier"), ColumnDefn(_(u"Type"), "left", 70, "typePrelevementStr", typeDonnee="texte"), ColumnDefn(_(u"Observations"), "left", 200, "observations", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun lot de prélèvements")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[2]) 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 # 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 FormateMontant(montant): if montant == None or montant == "": return "" return u"%.2f %s" % (montant, SYMBOLE) liste_Colonnes = [ ColumnDefn(u"", "left", 0, "index", typeDonnee="entier"), ColumnDefn(_(u"Label"), 'left', 100, "label", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Montant"), 'right', 90, "montant", typeDonnee="montant", stringConverter=FormateMontant), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun tarif")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[0]) 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 liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDunite"), ColumnDefn(_(u"Ordre"), "left", 70, "ordre"), ColumnDefn(_(u"Nom"), 'left', 300, "nom", isSpaceFilling=True), ColumnDefn(_(u"Unités principales associées"), "left", 220, "texte_unites_principales"), ColumnDefn(_(u"Unités secondaires associées"), "left", 220, "texte_unites_secondaires"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune unité")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def UI(self): entry = self.client.info(self.svnDir) self.rev_num = entry.revision.number version_info = u'现版本库为: %s' % self.rev_num self.text_head = wx.StaticText(self,label=version_info) mainSizer = wx.BoxSizer(wx.VERTICAL) self.resultsOlv = ObjectListView(self, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.resultsOlv.SetEmptyListMsg(u"没有更改的内容") self.filenameColumn = ColumnDefn(u"文件", "left", 350, "filename") self.statusColumn = ColumnDefn(u"状态", "left", 100, "filestatus") AllSvnList = self.setResults() checkBtn = wx.Button(self, label=u"全选") uncheckBtn = wx.Button(self, label=u"清空") self.button_save = wx.Button(self,label=u"提交",id=GL.CommitSvnOK) if len(AllSvnList) == 0: self.button_save.Disable() button_cancel = wx.Button(self,label=u"取消",id=wx.ID_CANCEL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(checkBtn, 0, wx.ALL|wx.ALIGN_LEFT, 5) btnSizer.Add(uncheckBtn, 0, wx.ALL|wx.ALIGN_LEFT, 5) btnSizer.Add(self.button_save, 0, wx.ALL|wx.ALIGN_RIGHT, 5) btnSizer.Add(button_cancel, 0, wx.ALL|wx.ALIGN_RIGHT, 5) mainSizer.Add(self.text_head, 0, wx.ALL, 5) mainSizer.Add(self.resultsOlv, 1, wx.EXPAND|wx.ALL, 5) mainSizer.Add(btnSizer, 0, wx.CENTER|wx.ALL, 5) self.SetSizer(mainSizer) checkBtn.Bind(wx.EVT_BUTTON, self.onCheck) uncheckBtn.Bind(wx.EVT_BUTTON, self.onUncheck) self.Bind(wx.EVT_BUTTON,self.OnCommitToSvn,id=GL.CommitSvnOK) button_cancel.Bind(wx.EVT_BUTTON,self.OnCancel)
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 self.imgVerrouillage = self.AddNamedImages("verrouillage", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Cadenas_ferme.png"), wx.BITMAP_TYPE_PNG)) def FormateDate(dateDD): if dateDD == None : return u"" return UTILS_Dates.DateEngFr(str(dateDD)) def GetImageVerrouillage(track): if track.verrouillage == 1 : return self.imgVerrouillage else: return None def FormatePeriode(periode): if periode == None or periode == "" : return u"" annee, mois = periode.split("-") listeMois = [u"_", _(u"Janvier"), _(u"Février"), _(u"Mars"), _(u"Avril"), _(u"Mai"), _(u"Juin"), _(u"Juillet"), _(u"Août"), _(u"Septembre"), _(u"Octobre"), _(u"Novembre"), _(u"Décembre")] return u"%s %s" % (listeMois[int(mois)], annee) liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 42, "IDlot", typeDonnee="entier", imageGetter=GetImageVerrouillage), ColumnDefn(_(u"Période"), "left", 150, "periode", typeDonnee="texte", stringConverter=FormatePeriode), ColumnDefn(_(u"Nom"), "left", 190, "nom", typeDonnee="texte"), ColumnDefn(_(u"Nbre pièces"), "center", 80, "nbrePieces", typeDonnee="entier"), ColumnDefn(_(u"Observations"), "left", 200, "observations", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun bordereau")) 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 FormateValeur(valeur): if type(valeur) == int: # Si c'est un nombre : return valeur if type(valeur) == decimal.Decimal: # Si c'est un montant if valeur > decimal.Decimal(str("0.0")): return u"+ %.2f %s" % (valeur, SYMBOLE) elif valeur == decimal.Decimal(str("0.0")): return u"0.00 %s" % SYMBOLE else: return u"- %.2f %s" % (-valeur, SYMBOLE) liste_Colonnes = [ ColumnDefn(_(u"Label"), "left", 115, "label"), ColumnDefn( _(u"Valeur"), 'right', 80, "valeur", stringConverter=FormateValeur), #, isSpaceFilling=True), ] if "linux" not in sys.platform: liste_Colonnes.insert(0, ColumnDefn(u"", "left", 0, "position")) self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune facturation")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="Tekton")) self.SetSortColumn(self.columns[0]) self.SetObjects(self.donnees)
def setStudents(self, data=None): self.dataOlv.SetColumns([ ColumnDefn("ID", "center", 50, "user_id"), ColumnDefn("Reg. No.", "center", 50, "reg_no"), ColumnDefn("Full Name", "left", 180, "full_names"), ColumnDefn("Form", "center", 50, "form"), ColumnDefn("Stream", "center", 70, "class"), ColumnDefn("Date of Birth", "center", 120, "dob"), ColumnDefn("Gender", "center", 70, "gender") ]) self.dataOlv.SetObjects(self.products)
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 GetImageDefaut(track): if track.defaut == 1: return "defaut" else: return None liste_Colonnes = [ ColumnDefn(u"", "left", 22, "IDprocedure", typeDonnee="entier", imageGetter=GetImageDefaut), ColumnDefn(_(u"Nom"), 'left', 300, "nom", typeDonnee="texte"), ColumnDefn(_(u"Interface"), 'left', 200, "interface", typeDonnee="texte", isSpaceFilling=True), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune procédure")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="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 DateEngFr(textDate): if textDate != None: text = str(textDate[8:10]) + "/" + str( textDate[5:7]) + "/" + str(textDate[:4]) else: text = "" return text def rowFormatter(listItem, track): if track.valide == False: listItem.SetTextColour((180, 180, 180)) liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 0, "IDscolarite", typeDonnee="entier"), ColumnDefn(u"Du", 'left', 70, "date_debut", typeDonnee="date", stringConverter=DateEngFr), ColumnDefn(_(u"Au"), 'left', 70, "date_fin", typeDonnee="date", stringConverter=DateEngFr), ColumnDefn(_(u"Ecole"), 'left', 160, "nomEcole", typeDonnee="texte"), ColumnDefn(_(u"Classe"), 'left', 100, "nomClasse", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Niveau"), 'left', 60, "abregeNiveau", typeDonnee="texte"), ] self.rowFormatter = rowFormatter self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune classe")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="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 # Création du imageList avec une taille personnalisée dictImages = {} imageList = wx.ImageList(TAILLE_IMAGE[0], TAILLE_IMAGE[1]) for track in self.donnees: indexImg = imageList.Add(track.bmp) dictImages[track.IDmode] = indexImg self.SetImageLists(imageList, imageList) def GetImage(track): return dictImages[track.IDmode] liste_Colonnes = [ ColumnDefn(_(u"IDmode"), "left", 0, "IDmode", typeDonnee="entier"), ColumnDefn(_(u"Image"), 'left', TAILLE_IMAGE[0] + 1, "", imageGetter=GetImage), ColumnDefn(_(u"Nom"), 'left', 400, "label", typeDonnee="texte"), ColumnDefn(_(u"Nbre émetteurs"), 'left', 190, "texte_emetteurs", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun mode de règlement")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[2]) 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(dateDD): return UTILS_Dates.DateComplete(dateDD) liste_Colonnes = [ ColumnDefn(_(u"ID"), "left", 50, "IDconso"), ColumnDefn(_(u"Date"), 'left', 150, "date", stringConverter=FormateDate), ColumnDefn(_(u"Individu"), "left", 180, "individu"), ColumnDefn(_(u"Activité"), "left", 160, "nomActivite"), ColumnDefn(_(u"Unité"), "left", 160, "nomUnite"), ] self.SetColumns(liste_Colonnes) self.CreateCheckStateColumn(0) self.SetEmptyListMsg(_(u"Aucune consommation")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="Tekton")) self.SetSortColumn(self.columns[2]) self.SetObjects(self.donnees)
def DoSelect(self, stmt): # Clear the existing query results self.myOlv.SetObjects(list()) # Run the query cur = self.connection.cursor() cur.execute(stmt) # Create a columnDefn for each column in the query. # The value to be shown in a cell is the i'th value in the list self.myOlv.SetColumns(ColumnDefn(x[0], valueGetter=i, minimumWidth=40) for (i,x) in enumerate(cur.description)) # fetchall() returns tuples which can't be modified in place, so we convert them to lists self.myOlv.SetObjects([list(x) for x in cur.fetchall()])
def __init__(self, parent, id, ptID): wx.Panel.__init__(self, parent, id) self.ptID = ptID self.problem = '' #receives the newly selected problem back from AddProblemDialog problems = prob_find(ptID) #for items in problems: #items["icd"] = findICD(items["short_des"]) self.problist = ObjectListView(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.problist.SetColumns([ ColumnDefn("Problem", "left", 400, valueGetter="short_des"), ColumnDefn("First Treated", "left", 100, valueGetter="prob_date"), ColumnDefn("ICD-10 Code", "left", 100, valueGetter="icd10") ]) self.problist.SetObjects(problems) self.problist.cellEditMode = ObjectListView.CELLEDIT_DOUBLECLICK self.problist.Bind(EVT_CELL_EDIT_STARTING, self.HandleCellEditStarting) self.problist.Bind(EVT_CELL_EDIT_FINISHED, self.HandleCellEditFinished) leftprob = wx.BoxSizer(wx.VERTICAL) rightprob = wx.BoxSizer(wx.VERTICAL) mainsizer = wx.BoxSizer(wx.HORIZONTAL) buttons = (('Add', self.OnNewProb, leftprob), ('Remove', self.OnRemProb, leftprob), ('icd Toggle', self.OnToggle, leftprob)) for label, handler, sizer in buttons: EMR_utilities.buildOneButton(self, self, label, handler, sizer) clock = EMR_utilities.makeClock(self, leftprob) rightprob.Add(self.problist, 1, wx.EXPAND | wx.TOP, 5) mainsizer.Add(leftprob, 0) mainsizer.Add(rightprob, 1, wx.EXPAND) self.SetSizer(mainsizer) listBilledICD(ptID)
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 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"Age"), "left", 50, "age", typeDonnee="entier", stringConverter=FormateAge), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun individu")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="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 rowFormatter(listItem, track): if track.date > datetime.date.today() : listItem.SetTextColour((180, 180, 180)) 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, "IDoperation", typeDonnee="entier"), ColumnDefn(_(u"Date"), 'left', 80, "date", typeDonnee="date", stringConverter=FormateDate), ColumnDefn(_(u"Libellé"), 'left', 180, "libelle", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Tiers"), 'left', 130, "nomTiers", typeDonnee="texte"), ColumnDefn(_(u"Mode"), 'left', 90, "nomMode", typeDonnee="texte"), ColumnDefn(_(u"N° Chèque"), 'left', 80, "num_piece", typeDonnee="texte"), ## ColumnDefn(_(u"Compte bancaire"), 'left', 120, "nomCompte"), ColumnDefn(_(u"Relevé"), 'left', 90, "nomReleve", typeDonnee="texte"), ColumnDefn(_(u"Débit"), "right", 80, "debit", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Crédit"), "right", 80, "credit", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Solde"), "right", 80, "solde", typeDonnee="montant", stringConverter=FormateMontant), ] self.rowFormatter = rowFormatter self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune opération de trésorerie")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, face="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 liste_Colonnes = [ ColumnDefn(u"", "left", 0, "IDcategorie", typeDonnee="entier"), ColumnDefn(_(u"Nom"), 'left', 200, "nom", typeDonnee="texte", isSpaceFilling=True), ColumnDefn(_(u"Abrégé"), 'left', 100, "abrege", typeDonnee="texte"), ColumnDefn(_(u"Journal"), 'left', 70, "journal", typeDonnee="texte"), ColumnDefn(_(u"Compte"), 'left', 300, "labelCompte", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucune catégorie")) 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 # Image list self.imgVerrouillage = self.AddNamedImages("verrouillage", wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Cadenas_ferme.png"), wx.BITMAP_TYPE_PNG)) def GetImageVerrouillage(track): if track.verrouillage == 1 : return self.imgVerrouillage else: return None def FormateDateLong(dateDD): if dateDD == datetime.date(1977, 1, 1) : return u"" else: 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", 42, "IDdepot", typeDonnee="entier", imageGetter=GetImageVerrouillage), ColumnDefn(_(u"Date"), 'left', 80, "date", typeDonnee="date", stringConverter=FormateDateCourt), ColumnDefn(_(u"Nom"), 'left', 170, "nom", typeDonnee="texte"), ColumnDefn(_(u"Compte"), 'left', 120, "nom_compte", typeDonnee="texte"), ColumnDefn(_(u"Observations"), 'left', 100, "observations", typeDonnee="texte"), ColumnDefn(_(u"Nbre"), 'centre', 40, "nbre", typeDonnee="entier"), ColumnDefn(_(u"Total"), 'right', 75, "total", typeDonnee="montant", stringConverter=FormateMontant), ColumnDefn(_(u"Détail"), 'left', 210, "detail", typeDonnee="texte"), ] self.SetColumns(liste_Colonnes) self.SetEmptyListMsg(_(u"Aucun dépôt")) self.SetEmptyListMsgFont(wx.FFont(11, wx.DEFAULT, False, "Tekton")) self.SetSortColumn(self.columns[1]) self.SetObjects(self.donnees)
def __init__(self, parent): wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY) # List the projects in the currently loaded .sav self.sav_project_list = utils.new_obj_list_view(self) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.open_song, self.sav_project_list) self.modified_since_load = False self.sav_project_list.SetEmptyListMsg("No .sav loaded") # Keep track of the projects to whose channels you're subscribing to # avoid subscribing multiple times self.subscribed_projects = {} def string_getter(x, attr): if x[1] is None: return "--" else: obj_attr = getattr(x[1], attr) if isinstance(obj_attr, (int, float, long, complex)): return utils.printable_decimal_and_hex(obj_attr) else: return obj_attr index_col = ColumnDefn("#", "center", 30, "index_str") mod_col = ColumnDefn("Modified", "center", 60, "modified") name_col = ColumnDefn( "Song Name", "left", 200, "name", isSpaceFilling=True) name_col.freeSpaceProportion = 2 version_col = ColumnDefn( "Version", "left", 50, "version", isSpaceFilling=True) version_col.freeSpaceProportion = 1 size_col = ColumnDefn( "Size (Blocks)", "left", 100, "size", isSpaceFilling=True) size_col.freeSpaceProportion = 1 self.sav_project_list.SetColumns( [mod_col, index_col, name_col, version_col, size_col]) self.open_sav_button = self.new_button( "Open .sav File ...", event_handlers.open_sav) self.save_sav_button = self.new_button( "Save .sav File as ...", event_handlers.save_sav, start_disabled=True) self.add_song_button = self.new_button( "Add Song from .lsdsng ...", event_handlers.add_song, start_disabled=True) self.add_srm_button = self.new_button( "Add Song from .srm ...", event_handlers.add_srm, start_disabled=True) self.export_song_button = self.new_button( "Export Selected as .lsdsng ...", event_handlers.save_song, start_disabled=True) self.export_song_srm_button = self.new_button( "Export Selected as .srm ...", event_handlers.save_song_srm, start_disabled=True) self.open_song_button = self.new_button( "Open Song ...", self.open_song, start_disabled=True, internal_handler=True) self.delete_song_button = self.new_button( "Delete Song", event_handlers.delete_song, start_disabled=True) self.Bind( wx.EVT_LIST_ITEM_SELECTED, self.handle_song_selection_changed, self.sav_project_list) self.Bind( wx.EVT_LIST_ITEM_DESELECTED, self.handle_song_selection_changed, self.sav_project_list) buttons_layout = wx.BoxSizer(wx.VERTICAL) def add_side_button(btn): buttons_layout.Add(btn, 1, flag=wx.EXPAND | wx.ALL) buttons_layout.AddSpacer(10) buttons_layout.AddSpacer(20) add_side_button(self.open_sav_button) add_side_button(self.save_sav_button) buttons_layout.AddSpacer(20) add_side_button(self.add_song_button) add_side_button(self.add_srm_button) buttons_layout.AddSpacer(20) add_side_button(self.open_song_button) add_side_button(self.delete_song_button) add_side_button(self.export_song_button) add_side_button(self.export_song_srm_button) window_layout = wx.BoxSizer(wx.HORIZONTAL) window_layout.Add(self.sav_project_list, 1, wx.EXPAND | wx.ALL) window_layout.AddSpacer(10) window_layout.Add(buttons_layout) window_layout.AddSpacer(10) self.SetSizer(window_layout)