Re: [gtk-list] [gtk-perl] statement of database



Hi Olivier,

Olivier Demah wrote:
> 
> I currently create an application that can manage the football (soccer)
> championship.
> So i create a database.
> And i need to keep the statement of the database in all my application,
> 
> but the "rules" of building with "glade_perl" is to make 2 .pm files :
> first with signal   : Foot.pm
> Second with the UI  : FootUI.pm
You must have Glade-Perl-0.48 to have FootUI.pm generated. The underlying
structure has changed a little from previous versions but you can use
old code with the new generated code. If you want to use the 'new' approach
it may be a good idea to do:
  mv src/Foot.pm Foot.pm.save
  mv src/SubFoot.pm SubFoot.pm.save
  glade2perl foot.glade # whatever your glade file is

look at the source files generated and read the docs to see how the 'new' 
approach is much simpler.

Snipped from the Glade-Perl-0.48 README:

2) Write several perl class files. 
   A) ProjectUI.pm   - the UI constructor class
   B) ProjectSIGS.pm - utilities and skeleton signal handlers
   C) Project.pm     - a base for your app that you can edit
   D) SubProject.pm  - an example subclass of your app that you can edit
   
Glade-Perl-0.48 will not overwrite the 'App' file (Foot.pm) or the 'App 
subclass' (SubFoot.pm) and you can edit these to handle the signals and 
do any application initialisation that you need. You can cut and paste 
any skeleton signal handlers from the FootSIGS.pm file into your app
but do not edit FootSIGS.pm or you will lose your changes.

> And here is my problem: because i need to put data of my championship
> in a CLIST widge , which widget is located in the FootUI.pm file and my
> connection to the database is located in Foot.pm, so what must i do to 
> solve my problem?
No problem, both files have the same perl packages/classes (eg 'window1' 
or whatever you called your toplevel form) so signal handlers and other
subs in the Project.pm classes are available to the UI.
 
> All i have found is to make only 1 file with both but i'd like to 
> continue to use Glade, and if i make 1 only 1 file, at the next
> "generation" of glade i have to start again from the beginning.
If you sill are having problems, email me personally and I will try to
explain more (and improve the docs).

Regards, Dermot




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