Changes between Version 11 and Version 12 of PadrePluginCookbookRecipie05


Ignore:
Timestamp:
08/07/11 17:51:48 (3 years ago)
Author:
bowtie
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PadrePluginCookbookRecipie05

    v11 v12  
    1616The examples here, where relevant will build upon Cookbook, some relate to other Plug-ins as it is more pertinent to use them, 
    1717 
    18  
    19  
    2018---- 
    2119== Outline 
     20* Plug-in Compliance, Things to do to make your Plug-in Load 
    2221Initial thoughts, of what a {{{Padre::Plugin}}} should provide, critiques welcome. 
    23 === Plug-in Compliance 
     22Plug-in Compliance 
    2423Things to do to make your Plug-in Load 
    2524* Plugin Manager can load plugin 
     25 
     26---- 
     27=== Plugin must have a Version 
    2628 * For compliance you will need to have a version in your Padre::Plugin::Name.pm. 
    2729{{{#!perl 
     
    3133---- 
    3234 
     35=== plugin_name 
     36 * Plugin must have a Name Don't forget to include the following sub. 
     371. ok I must be stupid but with out the **return** the POD just confused me, it's to terse. 
     381. {{{Wx::gettext(...)}}} this is use to wrap all test to be displayed in a Wx-object, more to follow relating to translations. 
     39{{{#!perl 
     40####### 
     41# Define Plugin Name required 
     42####### 
     43sub plugin_name { 
     44    return Wx::gettext('Plugin Cookbook'); 
     45} 
     46}}} 
     47 
     48---- 
     49=== padre_interfaces 
    3350* Plugin must declare it's **Interfaces**, all Padre Modules should be included 
    3451 * Don't forget to include the following sub. 
     
    131148---- 
    132149 
     150=== plugin_enable 
    133151* Some Plug-ins will require a plugin_enable method, 
    134152 * Why because it's using an external resource, which is not being picked up via perl (M::I). 
     
    166184---- 
    167185 
    168 * Registered_documents 
    169  * only if you have them  
    170 {{{#!perl 
    171 sub registered_documents { 
    172         'application/x-latex' => 'Padre::Document::LaTeX', 
    173         'application/x-bibtex' => 'Padre::Document::BibTeX',; 
    174 } 
    175 }}} 
    176 From {{{Padre::Plugin::LaTeX}}} 
    177  
    178 ---- 
    179  
     186=== plugin_disable 
    180187* Plugin_disable so that we can load and unloaded our Plug-in repeatedly, using Tools -> Reload All Plugins. 
    181188Don't forget to include all the relevant sections. 
     
    219226 
    220227---- 
    221 === POD 
     228 
     229=== plugin_icon 
     2301. from {{{Padre::Plugin}}} 
     231{{{#!perl 
     232sub plugin_icon { 
     233    my $class = shift; 
     234    my $share = $class->plugin_directory_share or return; 
     235    my $file  = File::Spec->catfile( $share, 'icons', '16x16', 'logo.png' ); 
     236    return unless -f $file; 
     237    return unless -r $file; 
     238    return Wx::Bitmap->new( $file, Wx::wxBITMAP_TYPE_PNG ); 
     239} 
     240}}} 
     241 
     2421. To define your your own icon, you can overload the method. 
     243{{{#!perl 
     244####### 
     245# Add icon to Plugin 
     246####### 
     247sub plugin_icon { 
     248    my $class = shift; 
     249    my $share = $class->plugin_directory_share or return; 
     250    my $file  = File::Spec->catfile( $share, 'icons', '16x16', 'cookbook.png' ); 
     251    return unless -f $file; 
     252    return unless -r $file; 
     253    return Wx::Bitmap->new( $file, Wx::wxBITMAP_TYPE_PNG ); 
     254} 
     255}}} 
     256 
     257 
     258---- 
     259 
     260=== registered_documents 
     261 * only if you have them  
     262{{{#!perl 
     263sub registered_documents { 
     264        'application/x-latex' => 'Padre::Document::LaTeX', 
     265        'application/x-bibtex' => 'Padre::Document::BibTeX',; 
     266} 
     267}}} 
     268From {{{Padre::Plugin::LaTeX}}} 
     269 
     270---- 
     271== POD 
    222272I have found {{{Catalyst::Controller::POD}}} to be the best way to view POD for me, as it correctly formats, highlights and colourise the syntax. it may be overkill but it's pretty. 
    223273* Licence 
     
    229279 * Good, contains: VERSION, BUGS AND LIMITATIONS, DEPENDENCIES. Passes xt/pod.t and xt/podcoverage.t for all Plugin files. 
    230280---- 
    231 === DEBUG 
     281== DEBUG 
    232282This is cool 
    233283* now I can keep my say(print) statements, but turn then on when I want, with out littering the terminal :) 
     
    241291perl dev -a -t Padre::Plugin::Cookbook::Recipe04::Main 
    242292}}} 
    243 ---- 
    244 === Translations 
     293 
     294---- 
     295 
     296== Translations 
    245297* [http://padre.perlide.org/trac/wiki/TranslationIntro Intro To Translation] 
    246298* Language Support [http://perlide.org/translations/ translations update] 
    247299 * English 
    248300 * etc.. 
    249 ---- 
    250 === OS Support, 
     301 
     302---- 
     303 
     304== OS Support, 
    251305don't forget to consider, your Plug-in should ideally work on all of the following platforms. 
    252306* Linux 
     
    260314 * Snow Leopard 
    261315 * Leopard 
     316 
    262317---- 
    263318 
     
    267322use inc::Module::Install 1.01; 
    268323}}} 
    269 ---- 
     324 
     325---- 
     326 
    270327=== CPAN 
    271 this is probably your end goal. 
     328this is probably our end goal. 
    272329* public repository 
    273330* about dialogue 
    274 * plugin has icon 
    275 ---- 
    276 === Additional documentation 
     331 
     332 
     333---- 
     334 
     335== Additional documentation 
    277336or Marketing your Plug-in and Padre 
    278337* trac wiki 
     
    280339 
    281340---- 
     341 
    282342== Tickets 
    283343Please Create New Tickets with the following additional information.