Thursday 14 May 2009

Friday 10 April 2009

AIKIDO seminar in London

We will be having a seminar with Takemori-sensei (7th dan Akikai). For details check there.

Monday 15 December 2008

Challenge

I decided to challenge myself and started the One Hundred Push-ups program, which as its name says leads you to the ability of doing 100 push-ups consecutively. It is a six week work-out prepared for people with different strength. You first test yourself by simply doing as many push-ups as you can and then you follow the schema which is suitable for you. My rankafter the initial test was rather quite low so if I really do it in six weeks I will be very proud of myself.

K

Sunday 7 December 2008

Menu and Table Widgets for Shoes

So finally Shoes 2.0 are released by _why - great JOB.

I had, therefore, the opportunity to test the new versions my Menu and Table classes on which I was working for several days. I have rewritten both of them so they are now inheriting from Shoes::Widget class and can be used as widgets. It greatly simplifies their usage. The code with tester application can be found at the Shoe-box repository: Menu and Table.
Have fun and MTFBWY.

K.

Sunday 30 November 2008

Shoes course

So, I finished another step in my Ruby skills development - a Shoes programming course at Rubylearning.com. It was really great fun, thanks to Satoshi - Soes Ninja. The course materials can be found here. I strongly recommend the course to everyone willing to learn this nice GUI toolkit and practice Ruby. Now, I will try to share my experience with others as an Assistant Teacher in the next batch. MTFBWY. K

Saturday 15 November 2008

Table in Shoes

I recently needed to display some data as a table using Shoes.

To this end, I created the class which creates the table: - Table.new(top, left, height, headers, items, blk), where:
- top, left - position of the top and left corner of the table
- height - number of rows to show without the vertical scrolling bar
- headers - array of arrays containing headers and widths of the columns) in the form of ["title", width]
- items - array of arrays containing data to be displayed
- blk - optional Proc object with a block to be called when the row is clicked.

As mentioned, rows are clickable and can invoke a block of code specified during initialization.

The table can be modified after creation. One can update the list of items to be displayed, make the table unresponsive to clicks, hide it and then show it again using provided methods, as well
as directly select a row or retrieve the info which row is selected.

The code of the class with a test application is available from The Shoebox repository.

MTPBWY

K.

Friday 26 September 2008

Menu in Shoes

Shoes is a lightweight GUI binding for Ruby programming language. It has many useful widgets description of which can be found in the docs. It however lacks menus, which are found in most modern applications. I spent few days trying to emmulate menu behaviour in Shoes and this is what I made:
Here we have two independent menus "Menu1" and "Menu2". Method
make_menu1(title, left, top, width, items, orientation, clickk, leavee)
takes 8 arguments:
  • title - title of the menu (string)
  • top, left - coordinates of the left upper corner (in pixels) of the menu title in the current slot
  • width - width of the menu (in pixels)
  • items - array of items (strings) to be displayed when menu pop-ups
  • orientation - should menu open horizontally (:hor) or vertically (:ver)
  • clickk - sholud menu open upon clicking the menu title (true) or by hoovering over it (false)
  • leavee - should menu close after mouse leaves the menu area (:leave_of) or should it stays on (:leave_on)
After clicking on Menu2 it opens as shown on the figure to the left:
Now if we click any item the method returns the item clicked and we can use it for any furhter action, e.g. like here:

make_menu("Menu2",80, 130, 70, items1, :ver, true, :leave_on){|x| alert "You clicked: #{x}"}

where the alert will be shown with the information on the item clicked :


It is very simple and easy to modify so that one could set up colors as well etc.
The code can be found here.

Hope you will have fun with it.