Skip to content

Instantly share code, notes, and snippets.

@batok
Created October 26, 2010 17:21
Show Gist options
  • Save batok/647342 to your computer and use it in GitHub Desktop.
Save batok/647342 to your computer and use it in GitHub Desktop.
ultimate.py
def anotaciones(self):
lc = self.lc
lc.ClearAll()
bg1 = wx.Colour(239,235,239)
bg2 = wx.Colour(255,207,99)
title = u"#,Fecha, Anotación"
for i, colTitle in enumerate(title.split(",")):
lc.InsertColumn(i,colTitle)
x = 0
for anotacion in model.session.query( model.Anotacion ).filter( model.Anotacion.relacion == self.data).order_by( model.Anotacion.fecha_elaboracion.desc()):
x += 1
i = lc.InsertStringItem(sys.maxint, "%05d" % x)
bgcolor = bg1
if i % 2 == 0:
bgcolor = bg2
lc.SetItemBackgroundColour(i, bgcolor)
col = 0
for atrib in "fecha_elaboracion,anotacion".split(","):
col += 1
try:
valor = str(getattr(anotacion,atrib))
except:
valor = getattr(anotacion, atrib)
#try:
#lc.SetStringItem(i,col,str(getattr(anotacion,atrib)))
#except:
#lc.SetStringItem(i,col,getattr(anotacion,atrib))
if atrib == "fecha_elaboracion":
item = lc.GetItem(i,1)
item.SetTextColour(wx.NamedColour("blue"))
item.SetText(valor)
lc.SetItem(item)
elif atrib == "anotacion":
item = lc.GetItem(i,2)
w = wx.TextCtrl( self.lc, -1, valor, size = ( 300, 80 ), style = wx.TE_MULTILINE)
item.SetWindow(w)
lc.SetItem(item)
else:
lc.SetStringItem(i,col,getattr(anotacion,atrib))
for i, colTitle in enumerate(title.split(",")):
if i == 0:
fila = lc.InsertStringItem(sys.maxint,"#%s#" % colTitle)
else:
lc.SetStringItem(fila,i,"#%s#" % colTitle)
sizes = { 2: 300 }
self.laststep( title, 50, fila, sizes = sizes )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment