Archive for the 'PHP-GTK' Category

Pro PHP-GTK Now Available

Monday, April 24th, 2006

Pro PHP-GTK is now available. Pro PHP-GTK was written to provide the reader with an understanding of the fundamentals of PHP-GTK. This approach empowers the user with the ability to create applications not by just copying and modifying the examples but by understanding what tools are available to solve a problem and how different pieces of the puzzle work together. The book goes into the details of parent and child relationships, signals and events, layout, displaying and collecting different types of data and customizing the look and feel of an application.

The table of contents (PDF) and Chapter 3, Understanding PHP-GTK Basics, (PDF) are both availabe from the Apress website. Please feel free to ask me any questions before deciding whether or not to buy this book. I will answer all questions as quickly as I can.

PHP-GTK News #9

Wednesday, April 19th, 2006

There wasn’t a whole lot of stuff going on this week in the world of PHP-GTK. I think the pace of the last few weeks has taken its toll and everyone is trying to recover. Although there wasn’t much going on, there was one important item, a plan for the release of the first alpha version of PHP-GTK 2. See the development section for details.

Development

Release plan for PHP-GTK 2-alpha1:
A plan of sorts has been up into place for the first official release of PHP-GTK 2. There are a few issues still out standing but once they are cleared up, we should be set for this very important milestone. First, all remaining patches must be reviewed to see which ones should be included in the release. Next some Windows issues must be cleaned up such as GtkFileChooser bugs and making sure the libs for the PHP that PHP-GTK 2 will be built against are up to date. Finally, the packaging script needs a quick update to include the generated files so that everyone doesn’t have to create these when they install PHP-GTK 2.

Documentation

Documentation updates:

Searching:
The PHP-GTK 2 manaul search is now active and set as the default for searching. Steph and Christian should be thanked endlessly for their work on getting the docs system up and running.
General

Wikipedia page updated:
The PHP-GTK Wikipedia page has been updated. Unfortunately, I can’t see what was written because the Wikipedia site is down. I’ll update this post when the page is available again.
PEAR

Call for Votes:
Structures_Form_Gtk2: A PHP-GTK 2 package providing groups, renderers and elements for Structures_Form.

Released:
PEAR_PackageUpdate_Gtk2: PEAR_PackgeUpdate_Gtk2 is a PHP-GTK 2 front end for PPU. It is designed to be used by PHP-GTK 2 packages and applications that want to include auto-updating features.

PHP-GTK News #8

Wednesday, April 12th, 2006

This week’s big news, documentation. When I came into work Monday morning, I had 106 new messages in my Docs inbox. That is 106 messages from Friday evening to Monday morning! That is a lot of activity.

Development

Patches applied by Andrei:
GtkWidget::set_visible() (Scott) - It is now possible to set the visibility of a wiget with just one call. You can show a widget using $widget->set_visible(true). You can hide it using $widget->set_visible(false). I tried writing this patch a few weeks ago but ran into some trouble. The key is to use zend_bool not gboolean.
GtkAboutDialog (Anant) - This patch fixes the get and set methods for aurthors, artists, and documentors.

New imagebrowser.php Demo:
Christian added a new demo to the demos/ directory. This application shows a list of previews for images in a directory and shows the selected image. Here is a screen shot of the app in action.

GtkTreeModel::set_column_types() Patch:
Andrei applied a patch to GtkTreeStore and GtkListStore. This patch allows for dynamically setting column types. It is useful if you need to create lists and trees on the fly. You can now do something like this:

$store = new GtkListStore();
$store->set_column_types(array(Gtk:TYPE_STRING, Gtk::TYPE_LONG));

More GdkPixbuf Patches:
The get_pixel, put_pixel, fill_area, save patches mentioned in earlier postings have been applied.

GtkRadioButton::get_group() Patch (Anant):
Anant has supplied a patch that fixes the implementation of GtkRadioButton::get_group(). This patch has not yet been applied.

Documentation

Doc updates:

Updates to the build process:
Andrei added the ability to make the docs as plain text. All you have to do is type: make text
Steph added the ability to make a small and quick test build of just one section. Here are two example runs:

$> make test id=tutorials.helloadvanced
/cygdrive/c/WINDOWS/xsltproc –param base.dir “‘testbuild/’” –stringparam rootid “tutorials.helloadvanced” –xinclude ./stylesheets/html/chunk.xsl ./scripts/manual.xml
Writing testbuild/tutorials.helloadvanced.html for chapter(tutorials.helloadvanced)

$> make test id=gtk.gtkbuttonbox
/cygdrive/c/WINDOWS/xsltproc –param base.dir “‘testbuild/’” –stringparam rootid “gtk.gtkbuttonbox” –xinclude ./stylesheets/html/chunk.xsl ./scripts/manual.xml
Writing testbuild/gtk.gtkbuttonbox.method.get_child_ipadding.html for method(gtk.gtkbuttonbox.method.get_child_ipadding)
Writing testbuild/gtk.gtkbuttonbox.method.get_child_secondary.html for method(gtk.gtkbuttonbox.method.get_child_secondary)
Writing testbuild/gtk.gtkbuttonbox.method.get_child_size.html for method(gtk.gtkbuttonbox.method.get_child_size)

pt_BR open for business:
The build process is now pretty stable. Because of this we can not only work on the regular documentation but also on translations. The Brazilian Portugese section is now ready for files to be committed.

General

Doc updates list active again:
The list of updates on the PHP-GTK homepage is now live again. Every night when the docs are rebuilt, the list will be updated. You can use that list to keep up to date on the latest documenation changes.

GtkTextBuffer
- Get cursor position:
Sean Coates asked how to get the current cursor position in a GtkTextView. The answer is, you can’t. The cursor is part of GtkTextBuffer not GtkTextView. In order to get the position from the buffer, you need to take two steps. First get the insert mark using get_insert() and then get the iterator at that mark using get_iter_at_mark(). Alternatively, if you are just looking for a way to insert text at the cursor on the fly, you can use insert_at_cursor().

IRC

Setting a GtkNotebook page:
Scoates was having trouble setting the page of a GtkNotebook that he wanted displayed on startup. He was trying something like this:

$nb = new GtkNotebook();
$page1 = $nb->append_page(new GtkLabel(’Test1′), new GtkLabel(’Test1′));
$page2 = $nb->append_page(new GtkLabel(’Test2′), new GtkLabel(’Test2′));
$nb->set_current_page($page2);

Even though he was setting the second page as the current page, when he showed the notebook, the first page was still showing up. The key is that you cannot set the current page until the notebook is realized.

PEAR

Releases:
Gtk2_EntryDialog: fixed speling in setRefaultResonse() to setDefaultResponse()

PHP-GTK News #7

Wednesday, April 5th, 2006

Not too much going on this week. The biggest item this week is that the PHP-GTK 2 documentation is now online!

Development

GdkPixbuf::draw_rgb_image() Override:
Andrei made overrides for draw_rgb_image() and draw_rgb_32_image(). The _dithalign versions are no more. This should work now.

$pixels = $frame->get_pixels() + $rowstride * $event->area->y + $event->area->x * 3;

To quote Andrei, “And you can’t treat PHP as C. It doesn’t have pointers. The correct way to do what you want it is to use substr().”

GtkIconView::get_selected_items() Patch:
The GtkIconView patch that Christian supplied last week has been applied. If you want to use this function you will have to compile the latest CVS version.

GtkFileChooserButton bug:
While working on PEAR_PackageFileManager_GUI_Gtk2 this week, I came across an issue with GtkFileChooserButton when setting the action to Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER. Several “Gtk-CRITICAL” messages appear. These errors don’t show up for everyone and they don’t show up in simple test scripts written in PyGtk or C. The cause and a solution is still under investigation. The bug report can be found in the tests/ directory of CVS.

Documentation

PHP-GTK 2 docs on gtk.php.net!
Thanks to the amazing work by Steph, the PHP-GTK 2 docs are now available online at http://gtk.php.net/manual/en/ The PHP-GTK 1 docs are still available under manaual1/ and are the default docs at the moment. While the build system is stable, the controller scripts that build the docs on a regular basis are not. Once they have been more thoroughly tested, the new docs will be automatically updated on a regular basis.

Updated Docs: (Note: not all updates are available online quite yet, see above.)

General

Server attacked:
The gtk.php.net server was attacked this week. I don’t know many details except for the fact that it had something to do with the Wiki (which will be replaced or moved soon) and that the site had to be move to a new temporary location.

New Unofficial Windows Binary:
Gnope.org has release an updated version of php_gtk2.dll for Windows users.

“For all those people that don’t want to wait until the new Gnope version is out: You can have the new php-gtk2.dll by simply installing a Gnope package now!

The package is “Gnope_PHPGtk2_dll” and can be found at
http://gnope.org/pearfront/index.php?package=Gnope_PHPGtk2_dll

PHP Quebec:
Andrei gave a talk about PHP-GTK 2 this week at the PHP Quebec conference. His talk focused on the changes from PHP-GTK 1 to PHP-GTK 2 including the new text widgets and the model/view structure. The slides from the talk are available at Andrei’s website: gravitonic.com.

PEAR

New Releases:
Gtk2_IndexedComboBox-0.1.0(beta):

  • NULL values can be used to unset the value
  • get_array() method
  • unit tests

Crisscott World Tour!

Friday, March 31st, 2006

OK. Well, not a world tour, but I am giving talks at four PHP User Groups this summer. First on the list is PHPDC, the Washington D.C. PHP User Group. I’ll be there on June 14th. Then on June 27th, I will be giving a lecture at the monthly NYPHP meeting. After a short break, I will be speaking at LIPHP, the Long Island PHP User Group on July 31st. Three days later, on August 3rd I will be in Boston speaking in front of the Boston PHP User Group.

I will be giving basically the same talk at all four events. The talk will be an introduction to PHP-GTK 2. Here is the abstract that is posted on the NYPHP site:

For most people PHP is a language that allows them to create dynamic web pages, but not much else. Many developers have probably used PHP on the command line in the form of PEAR but even this does not take full advantage of PHP’s power. PHP-GTK 2 is a PHP extension which combines the power of PHP 5 and Gtk+ 2 allowing developers to create standalone PHP applications free from the confines of a web browser. Applications written in PHP-GTK 2 can be much more powerful and interactive than those which rely on a web server.

This presentation will introduce the basic concepts of PHP-GTK 2. First we will discuss how an application can interact with the user via signals and events. Next we will see how to layout an application and present data to the user in many different formats. Finally, we will look at how to customize an application to give it a unique look and feel. These topics will be covered as we step through the process of creating a relatively simple PHP-GTK 2 application, which will be a sort of desktop mashup. The application will allow a user to search for an event using the EVDB web services API. Of course the user will want to know what the weather is like at the event, so the application will use the National Weather Service API to show the current weather in the destination city.

If you are in the area for one of these talks, please stop by.