pythonaro.com

Pythonaro blog

21 February 2010

KDE 4.4.0 on Kubuntu Karmic 9.10 -- a note of warning

I just upgraded my Kubuntu 9.10 "Karmic Koala" from KDE 4.3.4 to 4.4.0 using the backports repository. A note of warning: take a backup.

It took me something like 4 or 5 runs of apt-get dist-upgrade / apt-get -f install to get back a working setup. APT complained about a couple of things (python-qt3-doc conflicting with some newer package which includes the same examples, and Bilbo having been renamed Blogilo) but eventually pulled it through.

I was smart enough to backup the .kde home directory before launching a 4.4 session, and I'm glad I was. First run: Plasma crashed hard on a segfault, and didn't restart. Ok, this happened with some past upgrade already, let's just move away the old .kde home... got back a default desktop. Playing around with widgets, I hit another crash. And another. The culprit was always the Plasma Desktop, actual applications were running fine. Eventually, I moved back the old .kde home except the plasma* files under .kde/share/config/. This gave me back all my old KDE settings, except for Plasma. Win, I thought, and merrily set out to recreate my previous desktop arrangement.

Another crash.

So uhm. I'll try to track down what exactly Plasma doesn't like in my setup (which was, for the record, with two panels on left and right edge; Lancelot and a couple of QuickAccess widgets on the left, task manager and shutdown button on the right; two Plasma "views" and 4 virtual desktops), but if you are planning a similar upgrade, make sure you put aside some time for it, and get a good backup beforehand.

(I guess the question now would be "is it worth it?". Well, KDE does look more polished, applications are faster to launch and more responsive... it does look like we're finally at the point where one could upgrade from a 3.5.x release to 4.x and feel a bit awestruck.)

Labels: , ,

posted by GiacomoL @ 11:56 PM   0 comments links to this post

30 November 2008

How to disable access keys in Konqueror

Well, this suggestion by Dimitri on how to disable access keys in Konqueror made my day:

kwriteconfig --file khtmlrc --group "Access Keys" --key Enabled --type bool false

"Now press enter and voilà the access keys are sent to the eternal lands of /dev/null."

Labels: , ,

posted by GiacomoL @ 10:09 AM   0 comments links to this post

13 July 2008

Being a better typist

I confess: I am a "hunt'n'peck" typist. Like many, I didn't get lessons in typing, but thanks to my obsession for computers I developed my own particular form of "memory-touch-typing"; basically I'm fairly fast, but I only use 4-to-6 fingers, and I often have to stop and see where my hands ended up, which slows me down a lot and makes me lose concentration in what I was typing.

This means that periodically I get out a "learn to type" program and try to improve my typing skills. At the moment I'm working with KTouch, a nice GPL application belonging to the KDE Edutainment project. And I'm trying hard not to look at the keyboard while writing this!

Labels: , ,

posted by GiacomoL @ 2:56 PM   1 comments links to this post

08 June 2008

KDelicious documentation now online

I've just uploaded "the KDelicious Handbook", that is the documentation for all old (and new) KDelicious features.

This was the first time I used docbook to generate this sort of files, but I thought that it would have been nice to follow KDE guidelines, after all it's a KDE add-on!

Advantages of docbook: you write the docs once, then you can have as many stylesheets you want and get consistent output for different media. Using the KDE xsl files, it's really a snap.

Disadvantages: you have to write lots of markup, which can be painful; Emacs' SGML mode can help a bit there. Translation processes must be terrible, you have to re-write pretty much everything as there's no easy gettext-like method to keep style and content separated.

I've also written a small shell script to repeat the process, as I know tomorrow I'll forget everything I've learnt about meinproc and where the xsl templates are (/usr/share/apps/ksgmltools2/customization). The script also appends the Sourceforge logo to all pages meant for the web, as it's required by the SF policy (thanks to the wonders of sed). And of course it's all been put under version control. Am I "Pragmatic" or what?

Labels: , , ,

posted by GiacomoL @ 4:00 AM   2 comments links to this post

26 February 2008

KDED & me (& Python)

It's clear that KDelicious needs a background service to periodically synchronize with the server without user intervention. KDED seems the perfect answer to this, right? You can build modules that will be started and stopped with the desktop and managed with the "Service Manager" screen in the Control Center (KControl).

Unfortunately, KDED will only load a compiled shared library, not a script or a generic command (which would have been quite handy). I've no idea why, but I guess the KDE devs had their motives when they designed the system. The latest version of kdedistutils (in the pykdeextensions package, hosted on currently-down simonzone.org) only supports the creation of C++ "glue" modules for kparts and kpartplugins, so once again I'm a bit stuck. I guess what one would need is a stub similar to the one that pykdedistutils generates for KControl plugins, KParts and KPartPlugins... I'm not fluent in C++, but I'll see if I can hack my way through. If I manage, i'll send Simon a patch for pykdedistutils.

On a side note, I noticed a few issues with kdedistutils when building KControl modules:

  • it fails creating source distributions (but maybe it's me doing something daft)
  • when building a binary distribution (bdist), it doesn't do static linking, which means that the produced libs are not really portable and require libpythonize to be in the exact same position on the target host.

Labels: , , , , ,

posted by GiacomoL @ 9:17 PM   0 comments links to this post

22 February 2008

kdepyuic essential patch

This little patch for kdepyuic just made my day.

kdepyuic is a small utility to produce python files from .ui files produced by QtDesigner, ready to be used in PyKDE applications; it basically adds KDE-specific stuff to the standard pyuic utility (a .ui-to-.py compiler included in the generic PyQt distribution).
This i18n patch (courtesy of Stephan Hermann) solves a few headaches with importing the correct i18n function to translate stuff, and I'd strongly recommend everyone writing KDE apps in python to apply it.

(... and this means that a kdelicious release is on its way...)

Labels: , , , , , ,

posted by GiacomoL @ 7:39 AM   0 comments links to this post

28 January 2008

Ouch

First, I upgrade the ATI drivers on my linux laptop and they break 3D. Then Nokia buys Trolltech, the company behind Qt and KDE. Is this God's way to tell me to switch to a GNOME-based distribution? Sigh.

Labels: , , , , , ,

posted by GiacomoL @ 10:51 PM   0 comments links to this post

12 January 2008

Downloading KDE4

KDE 4.0 is out. I'm currently installing OpenSUSE 10.3 in a qemu image in order to test it (as openSUSE is the only distro to ship official binary packages right away -- and in a very good way: "KDE4 development" is even listed among their regular installation targets). Well, let's see if ti's really as good (or as bad) as people say.

Labels: , , ,

posted by GiacomoL @ 6:47 PM   3 comments links to this post

05 January 2008

The Linux community deserves better blogging tools

Dear lazyweb, did the KDE community ever produce a decent blogging tool?

All I can find are half-baked applets, or java programs, or GNOME programs, and they all fail miserably when trying to connect to Blogspot since Google launched the new API.

We only need a little plugin for Kate or Quanta to do a few things: connect, open a post, open a draft, publish. I tried to do it myself, with Python, adapting the examples that David Boddie posted a few years ago, but so far no luck (whenever the plugin is called, Kate segfaults); I guess it would be much easier in C++, I really should learn it sooner or later. Doing it the other way (by including kparts from Kate and then adding stuff) is wrong and much more wasteful, lots of tools could potentially get instant gains by having a KService to interoperate with the GData API. Or maybe something like this will be in KDE 4...?

If anybody builds it, I swear I volunteer for documentation and italian translation.

EDIT: what about a jEdit plugin? This would even be cross-platform. Uhmmm, nice little project...

Labels: , , , , , ,

posted by GiacomoL @ 4:55 PM   0 comments links to this post

18 December 2007

KDelicious 3.0 (+ roadmap)

After a few days of obsessive bugfixing, I've finally released KDelicious 3.0.

This is a big step forward from pykeylicious: it now uses PyKDE components to save preferences and interact with the network, which means transparent support for proxies and KWallet.

On the usability side, I've moved the option "Tag this post on del.icio.us" to its natural place, out of the submenu. There's now a GUI to manage options, which means that you can now switch del.icio.us username or choose how to rearrange your locally-synchronized bookmarks, all from a nice and simple interface.

Unfortunately, the resulting proliferation of files forced me to adopt a "proper" installer mechanism, and for now I settled on distutils. This has one major drawback: non-root installs are much harder than they used to be, if you don't know your way around python.

Mainly for this reason, I (foolishly) decided to maintain two codelines. Pykeylicious 2.x will still be available for people who can't be root or don't have/want the KDE bindings for python, in bugfixing mode. It will not have support for proxies, unless somebody else hacks it in. I hope this doesn't come back to bite me; I'm actually tempted to "downgrade" pykeylicious to 1.0, which got better feedback than 2.0.

In the short time (3.1) I'd like to get rid of all calls to kdialog. I resisted up to now because they work and are fairly low-maintenance, whereas using the proper bindings need a little bit more infrastructure, but they are really ugly and slow and I hate when dialogs stick around after the program crashes. I am also tempted to use the python-dcop bindings, but they look complicated and dcop is going away in KDE4 anyway, so I don't know if it's worth it.

One thing that didn't make it in KDelicious 3.0 is support for Ma.gnolia.
I personally don't use the service, but they (very cunningly) expose a mirror of the del.icio.us API to allow for an easy switch, so adding the new backend shouldn't be too time-consuming. Unfortunately they don't support bundles, which in KDelicious are very useful for sorting the locally-synchronized bookmarks. I'm thinking to add this "multi-backend" option in 3.5.

For 3.2 I might package it for debian. The only reason for the effort is to have an "uninstall" option, that distutil hasn't. It's a boring job, but probably necessary. I'll also try out other del.icio.us plugins to steal featu--- ahem, get "inspiration" for new features.

By the time all this is done, KDE4 will have been around for a while (see my previous post)... KDelicious 4 might be a very nice app by that time ;)

Labels: , , , , , ,

posted by GiacomoL @ 1:19 PM   0 comments links to this post

17 December 2007

Things I learnt last week on Python, PyKDE and KDE

  • if PyKDE segfaults on you, don't despair: you are probably just using the wrong arguments for a method call. Get the right invocation and you'll be fine, no need for recompilation or other drastic measures.
  • KCmdLineArgs is cool!
  • how to use KConfig from python (saves so much time):
    conf = KConfig("your_rc_file") # ends up in $KDEHOME/share/config/
    conf.setGroup("yourgroup")
    conf.writeEntry("your_option","your_string")
    # non-string values DON'T work
    conf.sync() # this will actually write out the stuff
  • KIO.NetAccess can save a lot of trouble storing passwords etc., seamlessly integrating with konqueror and kwallet
  • distutils is cool, in its own way. PyPi integration looks terrific, can't wait to upload my stuff there...
  • dependency checking in distutils still sucks. Either you go with setuptools, or you have to litter your setup.py with ugly import tests.
  • kdedistutils (from pykdeextensions) looks useful enough
  • the KDE TechBase is very good for KDE4. For KDE3, better to get the kdelibs-apidoc packages in your distro. Don't understand why (on Debian Etch) it doesn't register with QtAssistant.
  • Google Translations can be weird.

I'm very close to releasing "KDelicious 3.0", which is a big improvement on pykeylicious. While adding a few "simple" options to manage how del.icio.us bookmarks are imported into Konqueror, I tried to refactor out nontrivial code from the main script into modules, and added a GUI to manage these options. I also pushed the integration with KDE in order to do things like transparent proxy support and kwallet integration, which spared me from maintain connection code, passwords, etc... I ended up with several files to distribute, which required a "proper" installer.

This release will still use the kdialog hacks. I'll get rid of them in 3.1, because I really want to put this out before the end of the week and get some feedback.

On bookmark synchronization: in an ideal world, synchronization would be done in the background, if we are online, every couple of hours, and by just pulling the more recent posts. But this is a bad world, and I'm a bad coder... KDelicious will only synchronize manually, will download all your bookmarks each time it runs, and will just try to stop you from getting banned by del.icio.us if you launch it too often. The only way around this would be to write a KService or a systray applet (which would also allow me to support other "minor" browsers like Opera), but this stuff is changing in KDE4 so I don't want to spend time on it before march.

After Christmas I'll think about putting the code on sourceforge (or savannah, or something) and have a proper homepage for it. But first, let's release ;)

Labels: , , , , , , , , ,

posted by GiacomoL @ 2:46 PM   0 comments links to this post

04 December 2007

pykeylicious 2.0

Why stop when you're having fun? :)

pykeylicious 2.0 is out, with a brand new feature: local synchronisation of your del.icio.us bookmarks! I hope people will like that one (and the few bug fixes here and there).

Now I'll probably take a break; further features (heck, even the current ones) will require a configuration screen, and there is only so much you can do by leveraging kdialog. The logical step would be to implement a "proper" PyQt application, which will require a bit of time and effort; in the short term, I'll probably just release a 2.5 version to support system-wide installs (the only feature from konqil.icio.us that I didn't replicate).

Labels: , , , , ,

posted by GiacomoL @ 10:35 PM   0 comments links to this post

29 November 2007

On pykeylicious, Python vs Perl, and the state of Konqueror

If you use KDE, as I do, you should check out KDE-apps; it's a nice site full of all sorts of programs and add-ons for the desktop environment, from full-featured applications like K3B and Amarok to simple enhancement to the UI, kicker replacements, etc etc.

On this site, there is a fantastic little feature that allows you to "subscribe" to an application; when the application is changed/updated, you get a reminder via email. I personally subscribed to a few little apps (KShutdown, QtEmu, kio-locate...) that are not included in the standard KDE and are often off-the-radar for mainstream distribution packagers, so they are a bit difficult to track in the regular ways.

One of these apps was konqil.icio.us, an addition to the Konqueror right-click menu to do a few things with del.icio.us. Last night I found the email saying that a new version was out, so I went there and downloaded it; while reading the description, I immediately thought "why do I need to do all this messing with folders and permissions, a little installer could do it for me!". Then I checked the dependencies, and found that the script was in Perl... there was no chance I'd write an installer in Perl (I hate it) and send it to the original developer; also, adding a dependency on python for the installer looked a bit silly. So I decided to rewrite the script in python, add the installer, and upload it, and pykeylicious was born.

All this reminded me of how easily "tweakable" Konqueror (and KDE in general) is. You add a file in the right place under $HOME/.kde/, and you have just hooked the interface to your programs and scripts. The problem is often finding the right place; documentation exists in non-obvious places, as KDE developers tend to talk more about the C++ infrastructure.

I personally think this is one of the factors that stopped people from moving to Konqueror from Mozilla/Firefox: developing third-party extensions seems hard in comparison. This might or might not be the case; as konqil.icio.us demonstrated, it is fairly trivial to build a simple extension... however, if you want to manipulate webpages and the internal DOM, you have to write a C++ plugin, which might be easy for C++ coders, which net-people usually are not. Net-people like "easy" languages like java, javascript, python or ruby.

Last time I brought this up (yes, it's one of my pet-subjects) on the pykde list, I found out that yes, you can probably build plugins in python, but you have to jump through several hoops and basically try to fake that you are a C++ program. Not good enough. The day this sort of things becomes easy is the day that Konqueror goes back to be a serious alternative to FF in the Linux world.

Labels: , , ,

posted by GiacomoL @ 5:19 PM   2 comments links to this post