| 3 | | * Recipe-04 is now available in {{{Padre::Plugin::CookBook}}} see trunk |
| | 3 | [[PageOutline(1-4)]] |
| | 4 | |
| | 5 | = Padre::Plugin::Cookbook Recipe-04 Draft |
| | 6 | * Recipe-04 is all about {{{ListCtrl or ConfigDB}}} now available via {{{Padre::Plugin::CookBook}}} see trunk |
| | 7 | * Every Plug-in needs an About dialogue or Multiple Dialogues. |
| | 8 | * This page complements {{{Padre::Plugin::Cookbook Recipe-04}}}, just an aid, with a suggested layout, enjoy. More detail will follow in subsequent Cookbooks. |
| | 9 | * You can obtain this via svn Padre::Plugin::Cookbook into your working copy of Padre trunk. |
| | 10 | ---- |
| | 11 | == Tree Layout |
| | 12 | This has been covered in previous Recipes, here for continuity. |
| | 13 | {{{ |
| | 14 | Padre-Plugin-Cookbook/ |
| | 15 | ├── fbp |
| | 16 | │ └── Recipe04 |
| | 17 | │ ├── AboutFB.fbp |
| | 18 | │ ├── FrameFB.fbp (wx-frame unstable) |
| | 19 | │ └── MainFB.fbp |
| | 20 | ├── lib |
| | 21 | │ └── Padre |
| | 22 | │ └── Plugin |
| | 23 | │ ├── Cookbook |
| | 24 | │ │ └── Recipe04 |
| | 25 | │ │ ├── About.pm |
| | 26 | │ │ ├── FBP |
| | 27 | │ │ │ ├── AboutFB.pm |
| | 28 | │ │ │ └── MainFB.pm |
| | 29 | │ │ └── Main.pm |
| | 30 | │ └── Cookbook.pm |
| | 31 | ├── Changes |
| | 32 | ├── Makefile.PL |
| | 33 | ├── MANIFEST |
| | 34 | ├── t |
| | 35 | │ ├── 00.load.t |
| | 36 | │ ├── 01-Cookbook.t |
| | 37 | │ ├── 05-About04.t |
| | 38 | │ └── 05-Recipe04.t |
| | 39 | └── xt |
| | 40 | ├── changes.t |
| | 41 | ├── critic.t |
| | 42 | ├── hasversion.t |
| | 43 | ├── meta.t |
| | 44 | ├── minimumversion.t |
| | 45 | ├── podcoverage.t |
| | 46 | ├── podspell.t |
| | 47 | └── pod.t |
| | 48 | }}} |
| | 49 | NB Remember Padre can do some of this for you, see: [wiki:Features/ProjectSkeletonGeneration Project Skeleton Generation] |
| | 50 | ---- |
| | 51 | == {{{wxFormBuilder}}} (xml) |
| | 52 | * Use wxFormBuilder, v3.1.70 |
| | 53 | * Multiple! Why, well it's either a **Wx** thing or {{{FormBuilder}}} limitation, this is pants! Glade allows multi-dialogue's in single file. |
| | 54 | * The naming convention chosen starts to make more sense when you think about multiple dialogue's. |
| | 55 | * There is no pretty table to explain what's going on, you have to use {{{wxFormBuilder}}}, I suggest that you also view the *FB.fbp & *FB.pm files as well. |
| | 56 | |
| | 57 | === Create {{{MainFb.fbp}}} |
| | 58 | ||||=wxWidget=||||||||=Properties=||||=Events|| |
| | 59 | ||=Icon=||=Type=||name||label/title||public||other||type||value|| |
| | 60 | |---------------------------------- |
| | 61 | {{{#!td style="background: #ffd" |
| | 62 | [[Image(wxproject.png)]] |
| | 63 | }}} |
| | 64 | {{{#!td |
| | 65 | Project |
| | 66 | }}} |
| | 67 | {{{#!td |
| | 68 | Cookbook |
| | 69 | }}} |
| | 70 | {{{#!td |
| | 71 | n/a |
| | 72 | }}} |
| | 73 | {{{#!td |
| | 74 | n/a |
| | 75 | }}} |
| | 76 | {{{#!td |
| | 77 | n/a |
| | 78 | }}} |
| | 79 | {{{#!td |
| | 80 | n/a |
| | 81 | }}} |
| | 82 | {{{#!td |
| | 83 | n/a |
| | 84 | }}} |
| | 85 | |---------------------------------- |
| | 86 | {{{#!td style="background: #ffd" |
| | 87 | [[Image(wxdialog.png)]] |
| | 88 | }}} |
| | 89 | {{{#!td |
| | 90 | Dialog |
| | 91 | }}} |
| | 92 | {{{#!td |
| | 93 | Padre::Plugin::Cookbook::Recipe04::FBP::MainFB |
| | 94 | }}} |
| | 95 | {{{#!td |
| | 96 | Main |
| | 97 | }}} |
| | 98 | {{{#!td |
| | 99 | n/a |
| | 100 | }}} |
| | 101 | {{{#!td |
| | 102 | wxRESIZE_BORDER |
| | 103 | }}} |
| | 104 | {{{#!td |
| | 105 | n/a |
| | 106 | }}} |
| | 107 | {{{#!td |
| | 108 | n/a |
| | 109 | }}} |
| | 110 | |---------------------------------- |
| | 111 | |
| | 112 | |
| | 113 | === Create {{{AboutFb.fbp}}} |
| | 114 | ||||=wxWidget=||||||||=Properties=||||=Events|| |
| | 115 | ||=Icon=||=Type=||name||label/title||public||other||type||value|| |
| | 116 | |---------------------------------- |
| | 117 | {{{#!td style="background: #ffd" |
| | 118 | [[Image(wxproject.png)]] |
| | 119 | }}} |
| | 120 | {{{#!td |
| | 121 | Project |
| | 122 | }}} |
| | 123 | {{{#!td |
| | 124 | Cookbook |
| | 125 | }}} |
| | 126 | {{{#!td |
| | 127 | n/a |
| | 128 | }}} |
| | 129 | {{{#!td |
| | 130 | n/a |
| | 131 | }}} |
| | 132 | {{{#!td |
| | 133 | n/a |
| | 134 | }}} |
| | 135 | {{{#!td |
| | 136 | n/a |
| | 137 | }}} |
| | 138 | {{{#!td |
| | 139 | n/a |
| | 140 | }}} |
| | 141 | |---------------------------------- |
| | 142 | {{{#!td style="background: #ffd" |
| | 143 | [[Image(wxdialog.png)]] |
| | 144 | }}} |
| | 145 | {{{#!td |
| | 146 | Dialog |
| | 147 | }}} |
| | 148 | {{{#!td |
| | 149 | Padre::Plugin::Cookbook::Recipe04::FBP::AboutFB |
| | 150 | }}} |
| | 151 | {{{#!td |
| | 152 | Main |
| | 153 | }}} |
| | 154 | {{{#!td |
| | 155 | n/a |
| | 156 | }}} |
| | 157 | {{{#!td |
| | 158 | wxRESIZE_BORDER |
| | 159 | }}} |
| | 160 | {{{#!td |
| | 161 | n/a |
| | 162 | }}} |
| | 163 | {{{#!td |
| | 164 | n/a |
| | 165 | }}} |
| | 166 | |---------------------------------- |
| | 167 | ---- |
| | 168 | == {{{Padre::Plugin::FormBuilder}}} |
| | 169 | * {{{Padre::Plugin::FormBuilder}}} dose not support Wx menus yet, hence //fudge// work around in Main. |
| | 170 | * Use generator to create MainFB.pm from MainFB.fbp |
| | 171 | * Use generator to create AboutFB.pm from AboutFB.fbp |
| | 172 | * Tip have {{{Padre::Plugin::Cookbook::Recipe04::Main.pm}}} Open before running generator. |
| | 173 | * {{{Padre::Plugin::FormBuilder}}} {{{use FBP::Perl ();}}} |
| | 174 | * You need to read Source FBP::Perl for which Wx features are supported, **it's the only reference :(** |
| | 175 | |
| | 176 | ---- |
| | 177 | == Plug-in Code |
| | 178 | * Read POD for {{{Padre::Plugin}}} |
| | 179 | * Read POD for Cookbook.pm, Main.pm and About.pm. |
| | 180 | |
| | 181 | === {{{ListCtrl}}} |
| | 182 | |
| | 183 | === {{{Padre::DB}}} |
| | 184 | All DB access is via Padre::DB, you will also need to look at ORLite for supported features. Other wise it's just SQL via Padre DBC. |
| | 185 | * Read POD for [http://search.cpan.org/~plaven/Padre/lib/Padre/DB.pm Padre::DB] |
| | 186 | * Read POD for [http://search.cpan.org/~adamk/ORLite-1.50/lib/ORLite.pm ORLite] |
| | 187 | NB ConfigDB is just an SQLite DB. |
| | 188 | |
| | 189 | === {{{StatusBar}}} |
| | 190 | We have assumed //Show low-priority info messages on statusbar (not in a popup)// is **true**, \\ |
| | 191 | if not I suggest you set this in Tools->Preferences->Apperance |
| | 192 | {{{#!perl |
| | 193 | sub clean_session { |
| | 194 | my $self = shift; |
| | 195 | my $main = $self->main; |
| | 196 | |
| | 197 | $main->info('Cleaning Session relation'); |
| | 198 | .... |
| | 199 | } |
| | 200 | }}} |
| | 201 | === {{{ProgressBar}}} |
| | 202 | * Read POD for [http://search.cpan.org/~plaven/Padre/lib/Padre/Wx/Progress.pm Padre::Wx::Progress] |
| | 203 | ---- |
| | 204 | == Run |
| | 205 | * perl dev -a -die |
| | 206 | * You should now have Cookbook in your Tools menu, enjoy. |
| | 207 | |
| | 208 | ---- |
| | 209 | == Foot Notes |
| | 210 | === Testing |
| | 211 | These may help get you thinking in the write direction. |
| | 212 | * [http://oreilly.com/catalog/9780596100926 Perl Testing: A Developer's Notebook] |
| | 213 | * [http://www.mclean.net.nz/osdc-tdd-full.pdf An Introduction to Test Driven Development Using Perl] |
| | 214 | Padre can help you with this, see: [wiki:Features/AutomatedBuildAndTest Automated Build and Test] |
| | 215 | |
| | 216 | ==== Exrta Tests |
| | 217 | |
| | 218 | * I have recently been exposed to [http://beta.metacpan.org/module/Test::XT Test::XT], really cool. |
| | 219 | * Here is the reasoning [http://use.perl.org/~Alias/journal/38822 Journal article] Ouch. |
| | 220 | Alias++ |
| | 221 | |
| | 222 | **{{{__END__}}}** |