Saturday, 13 February 2010

Tk and Tkinter

There is really good online documentation and superb tutorials on Tk (including Tkinter) at TkDocs. In fact, this site had me re-evaluate my decision not to learn/use Tkinter for anything.

Unfortunately, about three seconds with IDLE was enough to change my mind back. In particular, Tk’s use of menu bars and menus doesn’t fit with Win/GTK/Qt/OS X standards at all.

python3 basics

I discovered a couple of gotchas in getting python3 up and running in Ubuntu 9.10 (and probably Lenny and Squeeze as well).

Install python3.

Install python3-tk. (This one is easy to miss.)

Add to source files:

#!/usr/bin/python3

To invoke, at the command line do

$ python3 foobar.py

Geany’s F5 doesn’t work because it makes compile and execute calls using python rather than python3. I am loathe to change it at this point because it may wreak havok on python2.6 stuff.

As potential alternatives there are idle-python3.0 and idle-python3.1 packages, which I will be evaluating todayish.

Monday, 1 February 2010

Sourcing .profile

In an earlier post I mentioned that XDM doesn’t source ~/.profile. Here is a collage of stuff that describes and solves the problem.

According to Jason Jesso, the basic problem is mentioned in the KDE FAQ:

9.11. KDE (kdm) does not read my .bash_profile!

Well, xdm (and kdm) does not run a login shell, so .profile, .bash_profile, etc. are not sourced. When the user logs in, xdm runs Xstartup as root and then Xsession as user. So the normal practice is to add statements in Xsession to source the user profile. Please edit your Xsession and .xsession files.

Useful details and a solution are offered by Bill Hassel:

Normally, when you run a script, the shell firks a new copy of the shell which then runs the script. All changes to shell environment are left with this shell. When the script terminates, the forked shell also terminates and nothing is passed back to the current shell except a numeric exit code.

Sourcing causes the current shell to run all the instructions locally, which leaves all the changes in the current environment. Any script can be sourced. The source command is just the character . (dot or period). You put the dot in front of the script with at least one space.

In other words, add

. ~/.profile

to .xsession

Another way is described by James Richard Tyrer

You can also change the first line of “/etc/X11/xdm/Xsession”:

#!/bin/bash -login

I’ll try this on a SD installation soon.

Saturday, 30 January 2010

A possible roadmap

First do a SkinnySqueezey, then do a SkinnyLucy.

SkinnySqueezey

SkinnyDebbie off Squeeze (alternate names: SkinnyLGM. SkinnyGreenie). This will probably have a slightly different motive than SkinnyLenny. Whereas earlier SkinnyDebbie versions had a “the absolutely lightest alternative for getting things done” motivation, it’s probably safe to assume that really old (i.e., RAM-limited; i.e., less than 256MB) hardware for which the above makes the most sense will be essentially nonexistent by the time Squeeze is released. This gives the project a bit more leeway to be nicer. So the new motivation may be, “Light, standard, effective, with as little Gnome as possible.” Probably something based on Openbox+fbpanel — and therefore resembling Crunchbang Linux, but with even less Gnome dependence and easy config for newbies.

Potential wins:

  • Debian is more solid in more places than Ubuntu.

Potential fails:

  • No PPA-ish alternative for newer packages.
  • Font rendering not as nice as Ubuntu.
  • Mixed su and sudo may confuse some interface issues.

SkinnyLucy

Adapting SkinnySqueezey to Ubuntu Lucid should be pretty easy once Lucid is released. This could start now, except the current Lucid installer doesn’t seem to work for command-line systems.

Potential wins:

  • Ubuntu’s PPAs
  • Lucy is an LTS
  • Ubuntu’s lovely font rendering
  • sudo only simplifies some interface issues

Potential fails:

  • Ubuntu’s sort-of odd/arbitrary maintenance habits for non-mainstream packages
  • Identical basic config in Karmic and Squeeze leaves Karmic many tens of MB larger

Saturday, 23 January 2010

Mulling over distribution bases

Debian

  • Solid, reliable, community oriented.
  • apt+synaptic is super.
  • 2 year release cycle.
  • Long release cycle is good because it simplifies Skinny maintenance issues.
  • Long release cycle is bad because s/w gets old, meaning that if the user wants updated s/w he/she will have to compile from source most of the time, deal with dependency issues, deal with XDG integration, etc. backports.org is a good idea but doesn’t seem especially active.

Ubuntu

  • Hugely popular, Debian-based, corporate.
  • 6 month release cycle with 2 year LTS releases.
  • PPAs make installing newer s/w fairly easy in many cases w/o resorting to user compilation.
  • Better font rendering than Debian for some unknown reason.

Fedora

  • Originates good ideas, community-oriented but with profit-driven associations.
  • Package mgmt is not as good as apt+synaptic.
  • I have installed one system that refuses to update for some unidentified reason … scary.

Right now I think the best options for the next Skinny are Debian and Ubuntu LTS. Ubuntu’s PPAs are really attractive. There has been talk of doing something similar for Debian (or even incorporating Debian into Ubuntu’s PPA system) but it hasn’t happened yet.