Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre python (publicaciones antiguas, página 43)

Blog desde LatinoWare

Salió mas o me­nos bien, pe­ro e que­dé sin tiem­po, no pu­de ha­cer pre­gun­tas y res­pues­ta­s, y no pu­de mos­trar ca­si el 20% del có­di­go.

De to­das for­ma­s, aquí es­tá el có­di­go en sus di­fe­ren­tes eta­pa­s, pa­ra ver la "e­vo­lu­ció­n" de una apli­ca­ción Py­Qt sen­ci­lla. Pro­ba­ble­men­te lo con­vier­ta en un tu­to­rial de ver­dad y pos­tear­lo.

Es­ta es la guía que es­ta­ba usan­do pa­ra no per­der­me cuan­do ha­cía la pre­sen­ta­ció­n:

    1. ba­­­ckend de la apli­­­ca­­­cion (1/­­­to­­­­­do­­­.­­­p­­­y)

    2. Ven­­­ta­­­na bá­­­si­­­ca con un treewi­­­dget (crear => wi­n­­­do­­­w.ui) Co­­­­­lu­­m­­­nas Ta­­­rea/­­­Fe­­­cha/­­­Tags ca­­m­­­biar no­­­m­­­bre del treewi­­­dget a lis­­­ta

    3. Co­­­m­­­pi­­­lar ar­­­chi­­­vo .ui, mo­­s­­­trar eje­­­cu­­­cion del mo­­­­­du­­­lo

    4. Te­­m­­­pla­­­te de mai­n.­­­py

    1. Ca­­r­­­gar da­­­tos del ba­­­ckend a la lis­­­ta

    2. Mo­­s­­­trar que la in­­­te­­­ra­­c­­­ción no ha­­­ce na­­­da

    1. Ex­­­pli­­­car si­­g­­­na­­l­s/s­­­lo­­­­­ts

    2. Mo­­s­­­trar la di­­­fe­­­ren­­­cia con 2 en mai­n.­­­py

    3. Ex­­­pli­­­car au­­­to­­­­­co­­­­­ne­­­xio­­­n, mo­­s­­­trar on_­­­lis­­­ta_i­­­te­­­m­­­Chan­­­ged

    4. Mo­­s­­­trar que la pe­­r­­­sis­­­ten­­­cia de Ta­­­rea fun­­­cio­­­­­na

    1. Sa­­­car de­­­co­­­­­ra­­­cion del ar­­­bol

    2. Ha­­­cer edi­­­ta­­­bles los ite­­­ms

    3. Ex­­­pli­­­car ca­­m­­­bios en on_­­­lis­­­ta_i­­­te­­­m­­­Chan­­­ged

    4. Ex­­­pli­­­car el pro­­­­­ble­­­ma con edi­­­tar fe­­­cha y tags in­­­li­­­ne

    5. Nue­­­va idea: dia­­­lo­­­­­go pa­­­ra edi­­­tar ta­­­reas

    6. Mo­­s­­­trar la­­­yout ma­­­na­­­gers

    1. Mo­­s­­­trar ca­­m­­­bios en mai­n.­­­py

    1. Co­­n­­­ce­­p­­­to de ac­­­cio­­­­­nes

    2. Mo­­s­­­trar ac­­­cio­­­­­nes en de­­­si­­g­­­ner

    3. Mo­­s­­­trar ac­­­cio­­­­­nes en mai­n.­­­py

    1. Tray

    2. Mo­­s­­­trar cla­­­se tray en mai­n.­­­py

    3. Mo­­s­­­trar co­­­m­­­po­­­r­­­ta­­­mien­­­to

    4. Mo­­s­­­trar otras di­­­fe­­­ren­­­cias en mai­n.­­­py

rst2pdf: presentations

I have been think­ing about us­ing rst2pdf to cre­ate pre­sen­ta­tion­s. I fin­ished ex­pos­ing PDF tran­si­tions to­day, and that part works nice­ly.

Still need­ed:

  • Some sort of "page dec­o­ra­­tion" fea­­ture.

  • Hand­out sup­­port? I think this would work nice­­ly with some sort of "con­di­­tion­al" di­rec­­tive. I need to think about it some more.

I in­tend to have that done for next fri­day, and re­lease then.

Programming and Life plans.

First a huge an­nounce­men­t: I will not re­lease any­thing to­mor­row. For the first time in 6 week­s, no fri­day re­lease from me!

Now, let's see what I'm plan­ning.

  1. I will be at Lati­noWare 2008 speak­ing about PyQt. The usu­al free beer of­fer: if you men­­tion this blog, I will buy you 1 (one) not very good beer. Be­ing in Brazil, that's prob­a­bly a Brah­­ma.

  2. rst2pdf de­vel­op­­ment is slow­ing down. The easy stuff is all done. There are some things I can do, though:

    • Ex­­­pose tran­si­­­tions to the writ­er (good for pre­sen­­­ta­­­tion­s)

    • "Back­­­­­ground" forms (a­­­gain, for pre­sen­­­ta­­­tion­s)

    • A mini-lan­guage ex­­­pos­ing the can­­­vas, so there is a use­­­ful "raw" mod­­­e.

    • Us­ing svglib in­­­stead of uni­­­con­ver­­­tor to han­­­dle SVG (but keep uni­­­con­ver­­­tor for oth­­­er vec­­­tor for­­­mat­s)

    • Re­­­do­ing list­s, which have a shaky code and bad lay­out

    • Fix half a dozen bugs

    • Make it work more like a unix app when in unix (re­spect en­vi­ron­­­ment vars, for ex­am­­­ple)

    How­ev­er, I am tak­ing a lit­­tle time off from it, and go­ing to try re­­viv­ing oth­­er pro­jec­t­s. Fo­­cus­ing in rst2pdf for two months did won­ders for it. Let's see if it can be re­­peat­ed!

  3. Try some more code golf­ing. I helped Nu­bis from PyAr reach the low­est­-s­­core of 74 in the grid chal­lenge. This is re­al­­ly fun stuff.

  4. I need more mon­ey. We have spent lots in ... plumb­ing. Yup. Two years of sav­ings spent on that. So, I need mon­ey. If you read this blog and want to make me hap­py, get me free­lance work. It can be sysad­min stuff, it can be pro­­gram­ming, it can be babysit­t­ing. I am good at all three things. Con­­tact me. I'm easy to find, and I am cheap­­(ish).

  5. No, I am not starv­ing. No, I am not in mon­ey prob­lem­s. Yes, my com­­pa­ny is do­ing very well, but it's an in­­vest­­men­t, not a cash cow (yet).

Golfing

I spent a few hours to­day round Code Golf and here's a neat thing I did.I think this is python's short­est pos­si­ble fac­to­ri­al:

f=lambda x:x<2or x*f(x-1)

You may say it's not cor­rec­t, be­cause f(1) re­turns True, but in­t(True) is 1, so it's al­most there ;-)

And here's a sur­pris­ing­ly read­able (as long as you know pas­cal's tri­an­gle) and not too long an­swer to their choose chal­lenge:

n,k=input()
a,c=1,0
while c<k:a*=n-c;c+=1;a/=c
print a

Contents © 2000-2024 Roberto Alsina