Glade-Perl
view release on metacpan or search on metacpan
use Glade::PerlGenerate;
# Choose the Generate run options.
# These options override the project_options
# which override user_options
# which override site_options
# which override Glade::PerlProject defaults
Glade::PerlGenerate->Form_from_Glade_File(
# User option Value Meaning Default
# ----------- ----- ------- -------
'app' => {
'author' => 'Dermot Musgrove <dermot.musgrove@virgin.net>',
# 'author' => undef, # Author string for sources eg values from Perl's
# 'My Name <my.email@some.org>' (gethostbyname("localhost"))
# 'version' => undef, # Version number to use 0.01
'date' => undef, # The date to show in sources Build time of
'copying' => undef, # Copying text to include
'description' => "This is an example generated by the Glade-Perl source code generator",
'use_modules' => 'Bus_mySUBS',
'allow_gnome' => undef, # Ignore/report Gnome widgets Ignore Gnome
},
'diag' => {
'verbose' => 2, # Level of verbosity 1
# 0 (quiet) to 10 (all)
'indent' => ' ', # Indent for source code 4 spaces)
'tabwidth' => 4, # Number of spaces to replace 8
# with a tab in source code
# 'wrap_at' => 0, # Wrap diagnostic messages 0 = no wrap
# at this character (approx).
# 0 = no breaks (not easy to
# read on 80 column displays)
# 'log' => "$log_file", # Write diagnostics to STDOUT
'autoflush' => 'True',
},
'source' => {
'indent' => ' ', # Indent for source code 4 spaces)
'tabwidth' => 4, # Number of spaces to replace 8
# with a tab in source code
'write' => 'True', # Write to the default files No source
# 'write' => 'STDOUT', # Write sources to STDOUT
# but there will be nothing
# to run later
# 'write' => 'File.pm', # Write sources to File.pm
# They will not run from here
# you must cut-paste them
# 'write' => undef, # Don't write source code
# 'style' => undef, # Generate OO AUTOLOAD code OO with subclass
# 'style' => 'Libglade', # Generate libglade type code
'style' => shift, # Each class to separate file
},
'glade2perl' => {
'dont_show_UI' => 'True', # Show UI during the Build Show UI
# and wait for user action
# 'my_perl_gtk' => '0.6123', # I have CPAN version 0.6123 Use Gtk-Perl's version no
# 'my_perl_gtk' => '19991001', # I have the gnome.org CVS Use Gtk-Perl's version no
# version of 'gnome-perl' that
# I downloaded on Oct 1st 1999
# 'my_gnome_libs' => '19991001', # I have the gnome.org CVS Use gnome-libs version no
# version of 'gnome-libs' that
# I downloaded on Oct 1st 1999
'xml' => {
'site' => '__NOFILE', # Site options file name /etc/gpgrc.xml
'user' => '__NOFILE', # User options file name ~/.gpgrc.xml
'project' => '__NOFILE',
# 'project' => $project_options_file,
# Project-specific options Don't read file
},
},
'glade' => {
'file' => $glade
},
);
}
sub string_test {
# Force diagnostics and source to be written line by line (autoflush)
# I need this for my editor's shellout to report fully on failure
select STDOUT; $| = 1;
# Build UI from a Glade XML string
Glade::PerlGenerate->Form_from_XML(
'verbose' => 1,
'write_source' => undef,
'dont_show_UI' => 'False',
'site_options' => '__NOFILE',
'user_options' => '__NOFILE',
'project_options' => '__NOFILE',
'xml' => &Test_XML_String )
}
sub Test_XML_String {
return
"<?xml version=\"1.0\"?>
<GTK-Interface>
<project>
<name>Form_from_XML</name>
<directory></directory>
<source_directory></source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gettext_support>False</gettext_support>
<gnome_support>False</gnome_support>
<use_widget_names>False</use_widget_names>
<main_source_file>gladesrc.c</main_source_file>
<main_header_file>gladesrc.h</main_header_file>
<handler_source_file>gladesig.c</handler_source_file>
<handler_header_file>gladesig.h</handler_header_file>
</project>
<widget>
<class>GtkWindow</class>
<name>window1</name>
<width>350</width>
<height>50</height>
<title>Progressbar and button from XML string</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_MOUSE</position>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
( run in 2.779 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )