RFC: Gtk2::Ex::Linker



Hi,

I wrote a simple module to link a database content to a Gtk2 window, and I thought that a suitable name would 
be

            Gtk2::Ex::Linker

and I'm planning to upload it on CPAN. 


Here's the rationale:

----------

NAME
       Gtk2::Ex::Linker - Use sql or an object-relational mapper to get data from a database and build a gtk2 
Gui using a glade file

SYNOPSIS

 use My::Form;
 use Rdb::MyTable::Manager;
 use Gtk2::Ex::Linker::RdbDataManager
 use Gtk2 -init;
 use Gtk2::GladeXML;
 

        my $builder = Gtk2::Builder->new();
         $builder->add_from_file($path_to_glade_file);

        my $data = Rdb::MyTable::Manager->get_mytable(query => [primary_key => {eq => $self->{pk}}]);
        my $dman = Gtk2::Ex::Linker::RdbDataManager->new({data=> $data, meta => Rdb::MyTable->meta });

        $self->{form_for_my_table} = Gtk2::Ex::Linker::Form->new({
                data_manager => $dman,
                builder =>      $builder,
              ....
            });


DESCRIPTION

The aim of this module is to automate the process of tying data from a database to widgets on a 
Glade-generated window. 
All that is required is that you name your widgets the same as the fields in your data source.
Step for use:

1) Instanciate a xxxDataManager object that access the database and contains the rows to display to the Form 
or Datasheet modules. 
        Currently there are three way to access the database: plain sql + DBI, Rose::DB::Object, and 
DBIx::Class 

2) Instanciate a Gtk2::GladeXML object 
3) Instanciate a Gtk2::Ex::Linker::Form object or a Gtk2::EX::Linker::Datasheet that displays the data from 
the DataManager using the glade file.

You would then typically connect the buttons to the methods below to handle common actions such as inserting, 
moving, deleting, etc.

This module is the same as Gtk2::Ex::DBI and Gtk2::Ex::Datasheet::DBI except that database access can be made 
using plain SQL or the ORM mentioned above.
Other ORM could be added if needed. The developer of Gtk2::Ex::DBI is not interested + has no time + no needs 
for including these change in the original modules unfortunately.

 I'm kindly asking for comments/suggestions/impressions about this idea and the namespace.

François 




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