Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about programming (old posts, page 2)

Almost a useful app

Lacks lots of stuff, but the UI is pret­ty much done.

Stuff need­ed be­fore pub­lish­ing:

  • Up­dat­ing posts (PyDS and ad­voga­to)
  • Delet­ing posts (PyDS and ad­voga­to)
  • Post­ing new (ad­voga­to)

Stuff done:

  • Ac­count cre­ation
  • Ac­count edi­tion
  • Post edi­tion
  • Post­ing new (PyD­S)
Sadly, I have lots of work for the next two or three days, so progress will slow.

And.... evil plug­in code! (I will re­do it some­day, may­be):

#Here acctype is one of "pyds" or "advogato"
#Both are mod­ules that de­fine a class called Ed­i­tor,    #which in­her­its a QWid­get 

ex­ec ("im­port "+ac­c­type+" as blog")
self­.Ed­i­tor=blog.Prop­er­ties(­par­en­t=­self.Frame,­name=str(ac­coun­t))
 

Of course, if an evil guy could re­de­fine the list of plug­ins and in­sert an evil mod­ule in­to your PYTHON­PATH, this would RE­AL­LY suck ;-)

Now, that was easy!

I al­ways dread the mo­ment when a pack­age has to be shared, and some­thing dis­tributable has to be made. You know, don't for­get any files, and such.

Not to men­tion the an­cil­lary night­mare of make/au­tomake/au­to­con­f/a­clo­cal/etc. I sim­ply trust­ed the kind­ness of strangers for that.

And I nev­er man­aged to make RPMs or any­thing like it. But dis­tu­tils makes in­stalling, dis­tribut­ing, re­al­ly sim­ple.

Here's an ex­am­ple:
#!/usr/bin/env python

from distutils.core import setup

setup (name="klog",
       version="0.0.1",
       description="klog: a PyQt blog tool",
       author="Roberto Alsina",
       author_email="ralsina@kde.org",
       url="//ralsina.me",
       packages=["klogmodules"],
       scripts=["klog.py"],
       long_description="""Long description here """

)

That is enough to build, in­stal­l, cre­ate RPM­s, De­bian pack­ages, in­clude the file in PyP­I, and who knows what else.

Have an­oth­er file in the pro­jec­t? Just toss it in the klog­mod­ules di­rec­to­ry, and it's done!

Of course this is on­ly for python app­s, but I don't see me cod­ing in oth­er lan­guages soon. The on­ly rea­son I got in­to C++ was be­cause there was no de­cent in­ter­pret­ed lan­guage with a de­cent toolk­it!

py2html trial

In the python list­ing at the end of the ar­ti­cle, I ap­plied py2html so it would get syn­tax high­light­ing.

In mozil­la it looks ok, in Kon­queror it flows over the box.

I won­der if that's how it's sup­posed to work and it on­ly looks well in Mozil­la by ac­ci­den­t.

Why python is nice

Nice post at me­chan­i­cal­cat.net, about why python makes good pro­gram­ming eas­ier, or at least not hard­er.


Contents © 2000-2024 Roberto Alsina