Python

Kubuntu QA Feedback Part Two

June 19th, 2009  |  Published in Application, Coding, Development, Kubuntu, Python

Yesterday I did a quick, well not so quick, post on some new tasks concerning Kubuntu QA and Feedback. I created a very crude plasmoid that would connect to a web survey so people could provide feedback during the development cycle. The first revision of this plasmoid had a hardcoded URL to the survey in question. So that meant that for every Alpha or RC release during the cycle, we would have to update the plasmoid with the new survey URL. This would become a pain. So I went forward trying to figure out a way to automagically handle this stuff.

My first initiative was to keep the plasmoid super simple and not have it do a lot of processing and stuff to figure out what to do. So enter PHP. I added a script on the server that the plasmoid will connect to. The only processing the plasmoid has to do is with lsb_release. When used with the flag -d, lsb_release will return only the “Description” of the current release of your system. This can be used to determine if the release is a stable release, or if it is a development release. Here are 2 example outputs to show this:

Stable:
lsb_release_stable

Development:
lsb_release_dev

QUIZ: Can you figure out the names of my computers from the 2 screenshots and how or why I named them? Jono, Jorge, and a few others over there in Michigan and here in Chicago, don’t answer! See if you can do this without Googling :)

So with the stable version, you can see the last bit in the line is the version number, in this case 9.04. In the development version instead of having the 9.04 it instead has karmic. So which ever value that the plasmoid gets when doing this it sends to the script like this:
http://foo.bar.com/foo.php?ver=9.04
If it is a development release, then it connects with ver=karmic.

Once the script gets that, it then does its magic. It first checks if the $ver is a string or a float. If it is a string, then it takes the string and looks over http://cdimage.ubuntu.com/kubuntu/releases/$ver. It parses the HTML and looks for the latest release under $ver. That then returns whatever the latest release is on the development side only. If $ver is a float, then it parses the HTML of the public survey list and matches up version numbers. Once either of these are complete, the $SID is returned, which is the last part of the URL to the respected survey. Then the PHP script magically redirects the plasmoid to the correct survey.

So with that, I think the Kubuntu Team is in good shape to have this as part of the Alpha 3 release, and possibly even sooner. I would still like to take this beyond a plasmoid and look at creating some sort of application for the desktop that can do everything for everybody, this way here we can pass it around to the rest of the distros so they can use it during their development cycles as well. If you have any ideas, please pass them on, or start hacking on it. I would be willing to lend a hand when the time warrants.

Kubuntu QA and Feedback

June 18th, 2009  |  Published in Coding, Development, Kubuntu, Python

Yesterday I decided that I would start tackling the QA side of things on the Todo List for Kubuntu Karmic. So with that I will be creating a QA policy for Kubuntu, which I am sure I build off of the current policies and guidelines for Ubuntu and other distros, since the work is already done pretty much, for the GNOME side of things. That’s what hackers do right? We hack together stuff until we get what we want :)

Well, one of the projects I have been tasked with is to create some sort of feedback system for Kubuntu. In the past we had utilized the wiki but this ended up being more of an inconvenience than anything. What would happen is on release day, everyone goes and gets their fresh Kubuntu download, and heads over to do some feedback. You know what happens when multiple people start editing a wiki page at the same time without realizing that it is locked by another user. CONFLICTS! So with that said, I headed on out to start working on some sort of feedback system that we could access with a plasmoid. After researching my options, which unbelievably there aren’t many, I landed my first alpha release utilizing Lime Survey (an awesome open source survey application) and created a quick plasmoid utilzing Plasma.WebView in Python. Literally, the plasmoid took me about 5 minutes from start to finish, it is that crude and simple right now.

Here are a couple screenshots of what it currently looks like in action:

feedback1

feedback2

It works, so that qualified it for a quick alpha to let people see it in action and hopefully come up with some ideas.

I have come up with a couple of ideas for the plasmoid because of a simple design flaw. Utilizing the plasmoid will only work during a Live CD session or after Kubuntu is installed and running. Now we all know that during a development cycle not everyone can have the luxury of a Live CD or an install going as planned. Because of this, the plasmoid would be useless, therefor causing us to go back to an archaic method of filling in the feedback. The Internet! At least we have the Internet. Some things I would also like to incorporate, which is probably just another 5 minutes with the plasmoid, is the ability to work on the survey offline, and then syncing as soon as you come online.

So with that said now, I decided that the Linux desktop platforms could really use a good feedback application. One that ties into the desktop and submits results back to a central location. So I got to thinking. How about doing it like 5-a-day is done using bzr? Nah, then I thought some more. How about something like the Ubuntu and Debian Popularity Contest? OK, so the backend/server/database part would be fairly simple and straight forward. Now the frontend part. How would the application work? So I thought about XML files that contained the feedback questions and configuration. So far, this makes the most sense, but isn’t XML such a pain, the ball-and-chain for Python? I have so many ideas on how to go forth with this, now I just need to make some time and start playing around with ideas. What do you all think?

Download Here

Once it is downloaded, you can install it by using the “Add Widgets” dialog or via the command line by doing:

plasmapkg -i kubuntu-qa-feedback.plasmoid

Then you can add it to your desktop using the “Add Widgets” dialog or test it out via the command line by doing:

plasmoidviewer kubuntu-qa-feedback

That’s it from me tonight, goodnight world and happy hacking!

Interrogation with Apport hooks – Qt Included

June 9th, 2009  |  Published in Coding, Development, FYI, KDE, Kubuntu, Python, Qt

Earlier today my buddy Martin Pitt blogged about how he needed a Qt developer to work on implementing the ui_question_choice() dialog. I looked through the code a bit this morning, and needed a little help right off the bat getting the GTK version running. One little thing I missed a bug report and Martin helped get it up and running. So as the day went on, storms came through, and for some reason I get in this storm hunter mode and nothing else gets done. Well, about an hour ago all the storms have cleared up and back to work I went. I spent about an hour, most of which was silly Qt Designer and layouts, which Kubuntu guys, I suck at, never listen to me brag about my Qt Designer classes again! The other thing that had me for a second was trying to iterate over a layout to get button statuses. After all was said and done, this is the little beauty that popped up when testing:

apport-qt4

Not to shabby. I will spend some time looking through all of the apport-qt ui stuff and see if I can make it as simple as the GTK side. The checkboxes in that image are generated dynamically by the hook. So once they are added to the layout, trying to figure out their status when they weren’t provided a name was tricky. Thankfully the PyQt 4 API Documentation is great!

So here it is, there is the main dialog and then there is the groupbox with a vertical box inside of it. The vertical box makes it simple to add and remove stuff so that’s why I went that route, KISS. So after the box is populate, you select the stuff you need then press OK to submit it. Well the trick was finding out what is checked. So the main dialog is named dialog and the vertical box that holds the check boxes is called vbox_choices. So here is how I got those values:

result = []
for c in range(0, dialog.vbox_choices.count()):
    if dialog.vbox_choices.itemAt(c).widget().isChecked():
        result.append(c)

So, the main reason for doing this, is so I can find it a bit easier next time, and the fact that I couldn’t find this little bit documented anywhere else. If there is a better way to do this, let me know.

EDIT: Removed the index variable as it was old code left hanging around when I did the copy and paste. Thanks Milian for catching that.

PyCon 2008

March 7th, 2008  |  Published in Personal, Python

Who all is going to PyCon 2008 in Chicago in the next week or so? If so what all are you going to be there for? Conferences? Tutorials? Sprints?

Seeing as I only live about 15 minutes from where PyCon is going to be hosted, I might show up one or two days to check it out, and have been thinking about meeting up with the Bazaar folks and the sprint they have planned. If you are going, leave a comment and maybe if I get some time off we can meet up.

IPv6 and Python question

June 27th, 2007  |  Published in Coding, Help, Python

OK my lazywebbers with IPv6 and Python experience, this goes out to you!

I am creating an application right now, with Python of course, and I need to set an environment variable to be always on when a user logs in. I have messed with the os.environ and the os.putenv and what not, but it doesn’t work permanently. This application doesn’t do anything more than a few tests and then sets the environment variable if the tests return true. Is there an easy way to write to ~/.bashrc or ~/.bash_profile to enable the variable, and then later on if the user wants they can disable the variable which would either remove the variable all together or would set it to False?

Another question I have is with IPv6. Is there an easy way to test and see if your network is an IPv6 network or an IPv4 network? Right now I am grepping /var/log/syslog for ‘no IPv6 router present’ and printing the ‘no’. If it is ‘no’ then the network is IPv4, and if it returns 0, then it is an IPv6 network. This is rather hackish I feel, but it does work. Just wondering if there is a better method to do this simple task.

Thanks everyone!