| Version 5 (modified by bowtie, 23 months ago) (diff) |
|---|
Padre::Plugin::Cookbook03
- Every Plug-in needs an About dialogue or Multiple Dialogues.
- This page complements Padre::Plugin::Cookbook03, it is not meant to be installable, just an aid, with a suggested layout, enjoy. More detail will follow in subsequent Cookbooks.
- Cookbook03.zip in Attachments.
Step 1 - Create Skeleton
- Assumption you are building in your copy of Padre trunk.
Padre-Plugin-Cookbook03/
├── fbp
│ ├── AboutFB.fbp
│ └── MainFB.fbp
├── lib
│ └── Padre
│ └── Plugin
│ ├── Cookbook03
│ │ ├── About.pm
│ │ ├── FBP
│ │ │ ├── AboutFB.pm
│ │ │ └── MainFB.pm
│ │ └── Main.pm
│ └── Cookbook03.pm
└── t
├── 00-load.t
├── 01-Cookbook03.t
├── 02-Main.t
├── 03-About.t
├── 04-pod.t
├── 05-pod-coverage.t
└── 06-perlcritic.t
Step 2 multiple.fbp (xml)
- Use wxFormBuilder, v3.1.70
- Multiple! Why, well it's either a Wx thing or FormBuilder limitation, this is pants! Glade allows multi-dialogue's in single file.
- The naming convention chosen starts to make more sense when you think about multiple dialogue's.
- There is no pretty table to explain what's going on, you have to use wxFormBuilder, I suggest that you also read the *FB.fbp & *FB.pm files as well.
Create MainFb.fbp
| wxWidget | Properties | Events | |||||
|---|---|---|---|---|---|---|---|
| Icon | Type | name | label/title | public | other | type | value |
Project | Cookbook03 | n/a | n/a | n/a | n/a | n/a | |
Dialog | Padre::Plugin::Cookbook03::FBP::MainFB | Main | n/a | wxRESIZE_BORDER | n/a | n/a | |
Create AboutFb.fbp
| wxWidget | Properties | Events | |||||
|---|---|---|---|---|---|---|---|
| Icon | Type | name | label/title | public | other | type | value |
Project | Cookbook03 | n/a | n/a | n/a | n/a | n/a | |
Dialog | Padre::Plugin::Cookbook03::FBP::AboutFB | Main | n/a | wxRESIZE_BORDER | n/a | n/a | |
Step 3 Padre::Plugin::FormBuilder
- Padre::Plugin::FormBuilder dose not support Wx menus yet, hence fudge work around in Main.
- Use generator to create MainFB.pm from MainFB.fbp
- Use generator to create AboutFB.pm from AboutFB.fbp
- Tip have Padre::Plugin::Cookbook03.pm Open before running generator.
- Padre::Plugin::FormBuilder use FBP::Perl ();
- You need to read Source FBP::Perl for which Wx features are supported, it's the only reference :(
Step 4 Perl Plug-in Code
- Read POD for Padre::Plugin
- Read POD for Cookbook03.pm, Main.pm and About.pm.
Plug-in tests
| Test name | Number | Result |
|---|---|---|
| 00-load.t | 1..1 | All tests successful. |
| 01-Cookbook03.t | 1..14 | All tests successful. |
| 02-Main.t | 1..7 | All tests successful. |
| 03-About.t | 1..6 | All tests successful. |
| 04-pod.t | 1..5 | All tests successful. |
| 05-pod-coverage.t | 1..5 | All tests successful. |
| 06-perlcritic.t | 1..5 | All tests successful. |
- Ticket #1227 add POD to *FB.pm
- All tests successful if you use replacement PerlX.pm
- critiques welcome.
Step 5 Run
- perl dev -a -die
- You should now have Cookbook03 in your Tools menu, enjoy.
- note the maximize icon on Output ( thanks to azawawi ).
$main->config->apply( 'main_lockinterface', 0 ); $self->config->write;
- note the maximize icon on Output ( thanks to azawawi ).
Foot Notes
Why Main, So we can have About
Well I needed a convention that I could expand upon. Which made sense to me, so here goes:
- MainFB.fbp is generated by wxFormBuilder,
- MainFB.pm is geneated from previous by Padre::Plugin::FormBuilder.
The FB tells me it's nought to do with me (FB FormBuilder).
- Main.pm is the event handler for MainFb.pm.
- About.pm is the event handler fo AboutFB.pm.
Garbage
- Padre::Plugin POD dictates that sub plugin_disable is required. See POD.
This is the flow of this Plug-in, note garbage is done by loading class not event handler.
- Padre Plugin loads
- Cookbook03
sub load_dialog_main {
- Main & MainFB loaded
sub load_dialog_about {
- About & AboutFB loaded
- Main unload About
sub plugin_disable {
- Main & MainFB loaded
- Cookbook03 unload Main
sub plugin_disable {
- Cookbook03
- Padre plugin unload Cookbook03
sub plugin_disable {
This process works, In that it dose not crap over Padre, But the Reload All Plugins is not predictable. either that or some one can kick me.
__END__
Attachments
-
wxproject.png
(842 bytes) -
added by bowtie 2 years ago.
wxWidget project
-
wxdialog.png
(811 bytes) -
added by bowtie 2 years ago.
wxWidget dialog
-
PerlX.pm
(5.3 KB) -
added by bowtie 2 years ago.
Padre::Plugin::FormBuilder::Perl.pm replacement PerlX.pm PBP
-
Cookbook03.zip
(19.3 KB) -
added by bowtie 21 months ago.
updated for Padre 0.90


