Announcing Gtk2::Ex::GraphViz - 0.01



Gtk2::Ex::GraphViz is a Gtk2 wrapper to the GraphViz.pm module.

GraphViz package can be used to produce good-looking network graphs.
Wrapping with Gtk2 allows those graph images to respond to events such
as mouse-over, clicked etc.

By implementing callbacks to the respective signals, you can create
fairly interactive network graphs. For example, when the user
double-clicks a node, you can open up a widget that contains
information on that node.

    use GraphViz;
    use Gtk2::Ex::GraphViz;

    # First do all the work in GraphViz.pm
    my $g = GraphViz->new;
    $g->add_node('London', shape => 'box', fillcolor =>'lightblue',
style =>'filled',);
    $g->add_node('Paris', label => 'City of\nlurve', );
    $g->add_edge('London' => 'Paris');

    # Now the actual Gtk2::Ex::GraphViz portion takes over
    my $graphviz = Gtk2::Ex::GraphViz->new($g);
    $graphviz->signal_connect ('mouse-enter-node' =>
      sub {
        my ($self, $x, $y, $nodename) = @_;
        my $nodetitle = $graphviz->{svgdata}->{g}->{g}->{$nodename}->{title};
        print "Node : $nodetitle : $x, $y\n";
      }
    );

TODO:
This is just an alpha release. Only mouse-enter, mouse-exit events are
implemented. I plan to implement clicked events soon. Also performance
kinda sucks on low end machines. I'll throw in a better search
algorithm to improve the performance.

And, by the way, its LGPL.

Feedback / Suggestions welcome.

Regards,

_Ofey.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]