Archive for January, 2009

Using Layouts In Qooxdoo – Part 1

Friday, January 30th, 2009

This is the first part of a tutorial series about layout managers, container objects and object hierarchies in Qooxdoo (qx for short from here on). Its target audience is mostly qx programmers coming from an (X)HTML/CSS/DOM background who have possibly used JavaScript libraries such as JQuery or prototype before. Qx is different, it is a JavaScript RIA Framework. If you have used a GUI toolkit such as Swing (Java), wxWidgets or GTK+ you should have no difficulty following this tutorial. In fact you will probably find it boring1. On the other hand if you are still trying to find out how you can attach your <div /> in an existing qx layout; you are in the right place.

The answer is “No”, to the question above. You don’t create DOM elements with qx (unless you are doing something really exotic). Actually you don’t need to concern yourself with the DOM at all. GUI is abstracted to a set of intuitive classes that you should be familiar from today’s desktop operating systems. This abstraction brings two big advantages:

  • Developers using qx don’t need to concern themselves with cross-browser issues.
  • Theming is easy and uniform.

Widgets Are The Building Blocks

A qx user interface is constructed using widgets. A widget is a class that encapsulates appereance, data and behaviour. For instance a TextField would render itself as a box and a caret, make the text you enter inside accessible programmatically and allow you to be notified whenever a the text data is changed. Widgets are customizable, subclassable and of course themable.

But a GUI hardly ever consists of a single widget. Instead there is a hierarchy of widgets. A container is a special kind of widget that has child widgets. A container widget ususally doesn’t have any visual parts itself and just render its children in its screen space. How child widgets are positioned within their container is decided by the container’s layout manager. Having a layout manager means the abstraction of layout strategy for maximum flexibility.

So how do containers, child widgets and layout managers work together? First of all qx positions everything with absolute coordinates (Yes; position:absolute) internally. But that doesn’t mean you need to position anything absolutely on the API level. Speaking in terms of JavaScript libraries; you can take advantage of floating/auto-sizing/liquid layouts. Position and size of all widgets are negotiated through this hierarchy. Theoretically everyone has a say. This means that you can set some constraints on parents and then some others on child widgets and they all work together. The resulting layout is then converted to absolute coordinates for rendering. (Examples in the next part)

Recap

  1. Qx GUI’s are hierarchically constructed from widgets.
  2. Each application has a root container.
  3. Each container has a layout manager and one or more child widgets2.
  4. A child of a container can be either:
    1. Another container.
    2. Or a control widget (such as a form widget).

NEXT PART: VBox Layout


1: You might want to see Qooxdoo – API documentation instead.

2: Although it is possible that a container may have no children, it is not sensible.

Bookmark and Share

Feed URL

Monday, January 19th, 2009

Appereantly Google has acquired FeedBurner and planning to do some changes with it. So I’d like to remove that external dependency and stop using FeedBurner. Please check your feed URL:

  • If you are using http://www.muhuk.com/feed/ then all is fine.
  • If your feed URL is http://feeds.feedburner.com/muhuk please change it to http://www.muhuk.com/feed/
Bookmark and Share

Techno Tuesday

Thursday, January 8th, 2009

I love Andy‘s humor with a distinct sadness in it.

Life

Bookmark and Share

Editors, Conventions and Evdenevenaklederiz.biz

Wednesday, January 7th, 2009

I went editor hunting again today. Lame, but I can’t help doing it time to time. My main editor is Kate for some time now. I use Pâté´s source browser when I am editing Python files. This is all fine for me. I love Kate. A multi-document editor and simple source inspection to jump through within the current file is all I need. But it gets hung. Depending on uptime it freezes up to ten seconds. This is sad.

A few days back I have installed SPE. All in all, it is a nice Python oriented editor1. I have had a good experience with it working on my main project. But when I tried to switch to my side project today, it did something amazingly stupid. When you change the workspace it fails to close currently opened files, and then adds them to the other workspace. Well, maybe it was me being amazingly stupid failing to figure out how to disable this feature. But this is unacceptable behaviour nevertheless.

I tried (again) eric after that. This time I didn’t panic when I saw an IDE style GUI on my screen. Eric should have done the job as well. I could have forgiven it not letting me customize the toolbars2… But it doesn’t show a static word wrap marker3! How can an editor feature dynamic word wrapping but could be unable to show a static word wrap marker?

When I was searching for something else, I had stumbled upon4 an e-mail message about KDevelop´s Class Browser. Did I ever mention that my searching skill is pathetic? It is. Anyway, I decided to try it out. So far so good. The class browser is not designed with Python in mind. But it is better than nothing. And the best news is the editor component is a KatePart. I’ll use KDevelop for programming and continue using Kate for other text editing, such as this one. We’ll see how it goes.

Conventions: A Necessary Evil?

OK, conventions are not evil at all. I have a bad habit of doing the opposite of what is dictated. It would be good thing if I had stopped and made an assessment. I should change from reactive to forethoughtful. Regardless, conventions from smart people are usually the right stuff.

For a long time I have been thinking; “why should I manually break lines, in this modern age of dynamic word wrapping” until I edited a configuration file on my server with Nano and spent two hours after, trying to find out why it wasn’t working. PEP8 says “Limit all lines to a maximum of 79 characters.“, do it. Because you can find yourself in a situation where you have to do without dynamic word wrapping and get your line breaks all messed up. Also, if you haven’t already done that; I would suggest you to take some time to read PEP8 and PEP257.

Another set of conventions I am interested in are Django conventions. I am in the process of splitting apps in my main project. I wasn’t planning a monolytic project in the beginning. But those two apps just got bigger and bigger and uglier… Now, as you can imagine; it is a painful process making them several smaller applications.

Why Am I Neglecting My Blog Lately

This main project I have been talking about from the beginning of this post is online now. You can visit here; Evdenevenaklederiz.biz (in Turkish). It is a simple tool for helping you find a mover. Critics and comments are very much appreciated.

I will be blogging regularly again soon. 3~5 posts per month is acceptable for me. Especially if at least one of them has some valuable information in it. I am not very ambitious about blogging.

Since this turned out to be more like a status update I should mention one last thing; my diet is finished last week. Currently I am 77 kgs, less than 15% fat. I am very happy with the results. For now my goal is to stay below 80 kgs, and focus on work. :D


1: Read: pretty much useless for anything other than Python.

2: Appereantly a newer version allows you to hide the toolbars.

3: You know that vertical line marking the 79th (or 80th) column.

4: No, not that stumbling upon.

Bookmark and Share