New Release: Lab Session Manager

Posted in Free and Open Source Software, Programming and Technical, Ubuntu on September 2nd, 2011 by doctormo

Over on launchpad, I’ve released version 1.4 of the lab-session-manager, included in this release is:

  • Bug fixes for administrators and other infinate time periods
  • Uses gnome’s SessionManager API to logout instead of SIGKILL
  • Pauses a logout until logging of logout event has completed
  • Correctly logs methods of logging out (session timeout, logoff button, off switch)

You can get your hands on the PPA and give it try here: DoctorMo’s Greeter PPA, Let me know what you think below in the comments.

Tags: , , , , , , , , , ,

Hot-Swapping Languages Batman!

Posted in Programming and Technical, Ubuntu on April 21st, 2011 by doctormo

One of the requirements for this community greeter (login screen for community center machines) is the ability to switch languages. Normally to switch a language you would unload the greeter and relaunch it with a LANG environment variable and your new language would fall into place from gettext.

But I wanted more. First, what languages are installed on the computer? For this I used python-pybabel and gettext, these two tools working together allow me to both get all the installed languages, limit them to just those I have translations for and show the translated name for the language (see screenshot below).

I decided that what I wanted to do was to hot-swap the text in the widgets. Since I’m using gtkme extensions, I could achieve this by creating a TranslatableWindow class. It’s job is simply to go through the window container at load time and note down all the translatable strings from labels and tooltips:

class TranslatableWindow(gtkme.Window):
“”"Provides functions for translating the window on the fly”"”
def __init__(self, *args, **kwargs):
Window.__init__(self, *args, **kwargs)
self.labels = []
self.tips = []
self.store_translations(self.window)

def store_translations(self, widget):
“”"Go through all widgets and store the translatable elements”"”
for child in widget.get_children():
if isinstance(child, Gtk.Container):
self.store_translations(child)
if isinstance(child, Gtk.Label):
self.labels.append( (child, child.get_label()) )
if child.get_has_tooltip():
self.tips.append( (child, child.get_tooltip_text()) )

def translate_to(self, lang):
“”"Loop through everything and translate on the fly”"”
lang = TEXTS[lang]
for (child, text) in self.labels:
child.set_label(lang.gettext(text))
for (child, text) in self.tips:
child.set_tooltip_markup(lang.gettext(text))
logging.debug(“Performed translation to %s” % lang)

Once I had translatable windows, I could tell my application class to go through each window and translate it if it was translatable:

def translate_to(self, lang):
“”"Translate all windows to target language”"”
for window in self._loaded.values():
if isinstance(window, TranslatableWindow):
logging.debug(“I18n window %s to %s” % (window.name, lang))
window.translate_to(lang)

Obviously because I’m not modifying the environment, when I log you on I need to update your language settings. I actually only show major language varieties and only ask about minor languages at registration time or when you change your setting:

If you’re even more curious, you can check out the code here: Launchpad Code or look at the translations here.

Tags: , , ,

GDM Greeter First User Interface

Posted in Programming and Technical, Ubuntu on April 14th, 2011 by doctormo

Update from my previous post: Here we have a branch containing a working gdm greeter user interface with a nice python module set for interacting with the gdm greeter service.

What’s nice about this code is how little of it you need to hack on the gdm. Binding up the username and password box to the events pretty much does everything. Most of the original functionality is simple to do.

The design isn’t final, there are gtk limitations and since gdm doesn’t really do clutter or opengl, it’d be impossible to do anything more interesting unfortunately.

The difference in functionality here is that you enter your full name (not your username) and it suggests people to you. The idea with this is that if you type in your name and you’re not a user, the next screen you see will be a register screen.

I selected my name from the list and then entered my passphrase:

Then it will log you in exactly as it should. Have a look at the code and see if you can hack on the gdm, it’s really very easy if you know a bit of python and gtk.

Comment if you do anything interesting.

Tags: , , ,

How to Make a Gnome Login Screen (in Python)

Posted in Free and Open Source Software, Programming and Technical, Ubuntu on April 12th, 2011 by doctormo

In Ubuntu we use Gnome and the GDM (Gnome Display Manager) login screen called gdm-simple-greeter. This program is fairly fully featured for a normal Ubuntu install and even has a configuration in /etc/gdm/custom.conf which you can play around with.

But, I want to do something special, I’m making a computer lab with a registration screen and other fun stuff. I’ll blog about the designs and code for that in a future blog post. Today I’m going to talk about how I made a gdm greeter in python despite the lack of documentation and the round-about API challenges.

First thing to realise is that GDM 2.30 which shipped with Ubuntu 10.10 has a rich and full service/client API via DBus. This allows me to do what I’m going to do because it allows my program to act just like the shipped simple greeter. Only a single greeter can talk over the DBus API and it’s worth noting that the API isn’t over the normal System or Session Dbus, it’s over a private dbus unix socket to prevent all sorts of security issues with passing passwords around.

I first deactivated the GDM greeter: `mv /usr/share/gdm/autostart/LoginWindow/gdm-simple-greeter.desktop ~/Desktop/` this will now not allow you to log into Ubuntu!

Next I developed a script which uses python’s DBus lower layers to connect over the private dbus address. The address is given to us via an environment variable ‘GDM_GREETER_DBUS_ADDRESS’ and we just feed that in as it’s randomly generated. Fill in the PASSWORD and USERNAME variables to have GDM handle the communication and log in, this is certainly not a script you should leave installed and I have written a better one with a gui now, just use it as an example.

Finally I developed a .desktop file which will autoload the example script when the login is ready. Copying that into the directory `/usr/share/gdm/autostart/LoginWindow/`.

To restart GDM I used this command as root: `service gdm stop && sleep 1 && service gdm start`

I used a VirtualBox machine which I communicated over via SSH in order to test this out, over and over, hacking away at how this could be done. You can try the same. The log files you should be watching are in `/var/log/gdm/:0-greeter.log` you’ll get all the stderr messages from your login screen in there as well as all the errors.

You can use DBus System connections on org.gnome.DisplayManager.Display to control the display and org.gnome.DisplayManager.UserManager to get lists of users, user information and events for when users are added and removed from the system, same goes for network manager and a bunch of other services running during the login session.

I’ll blog more, and perhaps video when I’m finished. For now, if you’re interested in login screen development for Gnome2 (I don’t know what they’re doing for Gnome3) then this will interest you.

Tags: , , , , , ,

Fighting Talk

Posted in Art and Creation, Cartoons and Comics, Critique, Doctor's Art, Free and Open Source Software, Ubuntu on March 14th, 2011 by doctormo

There has been a lot recently about community fighting. It’s been interesting, but also silly in a lot of ways because it’s a great deal about egos, and you know what happens when the immovable ego meets the unstoppable ego.

It's your fault for not doing what I asked three years ago!

Tags: , , ,

Genetic Wallpapers Now Available to Test!

Posted in Art and Creation, Free and Open Source Software, Multimedia Entry, Ubuntu, Video Entry on December 18th, 2010 by doctormo

In my previous videos I showed off some scripts which modified some svg files and made the desktop background shift and move randomly and with determination towards pre-set patterns.

In this video I show you how to install the new packages for testing and how you can make your own:

View Video on Blip

Your thoughts? have you ested my new packages and do they work for you?

Tags: , , , , ,

Ever Wondered WTF Gnome vs Ubuntu?

Posted in Free and Open Source Software, Ubuntu on November 12th, 2010 by doctormo

This post will either go one of two ways, either people will get more irritated or it will shed some light on why seemingly rational people keep on doing seemingly irrational things.

From near as best I can tell, we look like this:

Your agreement may vary, post below (politely) if you do or don’t agree with my graphic.

Tags: , , ,

Why Gnome? Why.

Posted in Free and Open Source Software, Hat Talk, Programming and Technical, Ubuntu on September 22nd, 2010 by doctormo

I have a love/hate relationship with gnome. I use it, I develop for it and at the same time I dislike the way the gnome project produces functional libraires.

Take for example librsvg, an awesome library for turning svg files into pngs for display and for making thumbnails. For some unintelligent reason installing or compiling librsvg requires gtk and thus also requires avahi and hicolor-icon-theme, xrandr and libcups2. Does making a png out of an svg require us to send icons to a rotated screen connected to a networked discovered printer? No? Then why do I need all this stuff?

The problem as I see it is that librsvg should be split out more into it’s none-gtk library parts and it’s pixbuf/gdk parts. Making it a useful library to a wider audience from servers to other desktop systems. Larger audiences mean more attention and more attention means more bug fixes.

The gnome project historically I think didn’t have much of a culture of serving a wider ecosystem and saw gaps and filled those gaps with gnome-only libs. It pains me to say but as a programmer I’m disappointed by the lack of foresight even though I understand resources were always tight. A “do everything with gtk deps” culture produces inflexible libs with rare logical separation between layers and fewer opportunities to share with the wider community because of it.

I’ve always hoped that the FDO culture of sharing APIs and working towards standard consensus would help the culture along and promote a culture of making libs for everyone.

Does anyone know of any alternatives to librsvg that produce good results? imagemagik failed to meet standards as it doesn’t support most of the filter effects, but I don’t know of many others.

just my 2 cents, what are your thoughts?

Tags: , ,

Whoa! Where’s it going?

Posted in Art and Creation, Free and Open Source Software, Ubuntu, User Interface Design on September 4th, 2010 by doctormo

After good healthy interest in yesterday’s video I decided to post the code in a repository (GPLv3 and CC-BY-SA) and as a second act to deliver Mark Shuttleworth’s feature request which I show off in the new video:

View Video on Blip

This is particularly cool since it means desktops will converge and look the same at certain dates as well as diverge and look different at all other times. What are your thoughts?

Tags: , , , ,

Gnome Icons: What the Devels are up to

Posted in Critique, Economics, Free and Open Source Software, Sociology, Ubuntu, User Interface Design on February 24th, 2010 by doctormo

My friend leftyfb over on his blog has highlighted an issue with gnome that I always thought was a genuine oversight. i didn’t think that the gnome developers were seriously and deliberately removing the icons from certain menus. For the past few months, every time I went into the System menu, I thought the missing icons were because some bug that no one could find the time to fix, had crept in.

Apparently not. according to records it was a discussion by developers to remove visual queues and make Ubuntu harder to use for dyslexics like myself. Forcing us to read words which we can very easily misread and not letting us use icons in which a combination of shape and colour can act as reinforcing cues for the noun of these menus.

I know dyslexia isn’t a fun disability like blindness and deafness, but a little consideration would have been nice.

The exact regression aside, Mike points out in his blog another worrying facet that I’ve seen myself all too often in the gnome developer community. A community of disagreeableness. As I was saying yesterday in my blog post about disagreeable filtering: Being nasty and obnoxious is a poor man’s user contribution filter compared to being patient, understanding and using dialectical tools to work out problems so they can achieve as many wishes as is possible.

I don’t expect devels to say they’re good at design when they are only good at systematics. If you’ve worked out some of the science or some basic principles of design, it doesn’t make you a designer. It’s not always parcelled into simple rules and regulations. Sure, sometimes they help, but they’re at best guidelines and a good starting point and you’re not expected to use them as iron clad regulation. Of course this is an obvious warning sign that the coders have taken to design before learning anything about servitude let alone elegance.

I’m not pleased with gnome developer’s attitudes. Yes, sure, users are annoying, but why aren’t you asking them for money in exchange for listening to them? Instead you’re pretending that you’re an open community that welcomes contributions from unskilled users, but in fact want to cut yourself off from all users. A sort of Unenlightened self interest, the bastard brother of Enlightened self interest who is responsible for cutting ties between developers as users and pure users.

This is why I protest that we MUST start being honest about how progress is funded. You only have to listen to the people that control the purse strings, listening to anyone else is charity and is not guaranteed in any way. If we want to have users making a real difference in the community and ultimately getting the software that they want to have, then we MUST make sure those users have a way to pay for such services.

If we want to have users making a real difference in the community and ultimately getting the software that they want to have and not the software that we think they ort to have, then we have to listen to them and be able to ask them to pay for the time of developers.

Tags: , , , , ,