~ubuntu-branches/ubuntu/saucy/padre/saucy-proposed

« back to all changes in this revision

Viewing changes to lib/Padre/Plugin.pm

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont, gregor herrmann, Dominique Dumont
  • Date: 2012-01-04 12:04:20 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20120104120420-i5oybqwf91m1d3il
Tags: 0.92.ds1-1
[ gregor herrmann ]
* Remove debian/source/local-options; abort-on-upstream-changes
  and unapply-patches are default in dpkg-source since 1.16.1.
* Swap order of alternative (build) dependencies after the perl
  5.14 transition.

[ Dominique Dumont ]
* Imported Upstream version 0.92.ds1
* removed fix-spelling patch (applied upstream)
* lintian-override: use wildcard to avoid listing a gazillion files
* updated size of some 'not-real-man-page' entries
* rules: remove dekstop cruft (replaced by a file provided in debian
  directory)
* control: removed Breaks statement. Add /me to uploaders. Updated
  dependencies
* rules: make sure that non-DFSG file (i.e. the cute butterfly, sigh)
  is not distributed

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
  # Declare the Padre interfaces this plug-in uses
22
22
  sub padre_interfaces {
23
 
      'Padre::Plugin'         => 0.29,
24
 
      'Padre::Document::Perl' => 0.29,
25
 
      'Padre::Wx::Main'       => 0.29,
26
 
      'Padre::DB'             => 0.29,
 
23
      'Padre::Plugin'         => 0.91,
 
24
      'Padre::Document::Perl' => 0.91,
 
25
      'Padre::Wx::Main'       => 0.91,
 
26
      'Padre::DB'             => 0.91,
27
27
  }
28
28
 
29
29
  # The command structure to show in the Plug-ins menu
52
52
use YAML::Tiny     ();
53
53
use Padre::DB      ();
54
54
use Padre::Wx      ();
 
55
use Padre::Unload  ();
55
56
 
56
 
our $VERSION    = '0.90';
 
57
our $VERSION    = '0.92';
57
58
our $COMPATIBLE = '0.43';
58
59
 
59
60
# Link plug-ins back to their IDE
181
182
        my $file  = File::Spec->catfile( $share, 'icons', '16x16', 'logo.png' );
182
183
        return unless -f $file;
183
184
        return unless -r $file;
184
 
        return Wx::Bitmap->new( $file, Wx::wxBITMAP_TYPE_PNG );
185
 
}
186
 
 
187
 
=pod
188
 
 
189
 
=head2 C<plugin_wizards>
190
 
 
191
 
The C<plugin_wizards> method will be called by Padre when it retrieves the wizard list.
192
 
 
193
 
The default implementation returns an empty list
194
 
 
195
 
=cut
196
 
 
197
 
sub plugin_wizards {
198
 
        return ();
 
185
        return Wx::Bitmap->new( $file, Wx::BITMAP_TYPE_PNG );
199
186
}
200
187
 
201
188
=pod
239
226
 
240
227
# Convenience integration with Class::Unload
241
228
sub unload {
242
 
        require Class::Unload;
243
229
        my $either = shift;
244
230
        foreach my $package (@_) {
245
 
                Class::Unload->unload($package);
 
231
                Padre::Unload::unload($package);
246
232
        }
247
233
        return 1;
248
234
}
367
353
    Wx::Event::EVT_MENU(
368
354
        $self->main,
369
355
        $item,
370
 
        sub { Wx::MessageBox('sh sh sh sh', 'Mutley', Wx::wxOK, shift) },
 
356
        sub { Wx::MessageBox('sh sh sh sh', 'Mutley', Wx::OK, shift) },
371
357
    );
372
358
  }
373
359
 
374
360
 
375
361
If implemented in a plug-in, this method will be called when a
376
362
context menu is about to be displayed either because the user
377
 
pressed the right mouse button in the editor window (C<Wx::MouseEvent>)
378
 
or because the C<Right-click> menu entry was selected in the C<Window>
379
 
menu (C<Wx::CommandEvent>). The context menu object was created
380
 
and populated by the Editor and then possibly augmented by the
381
 
C<Padre::Document> type (see L<Padre::Document/event_on_right_down>).
 
363
triggered the event right in the editor window (with a right click
 
364
or Shift+F10 or the context menu key) or because the C<Context Menu>
 
365
menu entry was selected in the C<Window> menu (C<Wx::CommandEvent>).
 
366
The context menu object was created and populated by the Editor and
 
367
then possibly augmented by the C<Padre::Document> type
 
368
(see L<Padre::Document/event_on_context_menu>).
382
369
 
383
370
Parameters retrieved are the objects for the document, the editor, the
384
371
context menu (C<Wx::Menu>) and the event.
429
416
be when the user wishes to disable the plug-in, when the plug-in is being
430
417
reloaded, or if the plug-in is about to be upgraded.
431
418
 
432
 
If you have any private classes other than the standard C<Padre::Plugin::Foo>, you
433
 
should unload them as well as the plug-in may be in the process of upgrading
 
419
If you have any private classes other than the standard C<Padre::Plugin::Foo>,
 
420
you should unload them as well as the plug-in may be in the process of upgrading
434
421
and will want those classes freed up for use by the new version.
435
422
 
436
 
The recommended way of unloading your extra classes is using
437
 
L<Class::Unload>. Suppose you have C<My::Extra::Class> and want to unload it,
 
423
The recommended way of unloading your extra classes is using the built in
 
424
C<unload> method. Suppose you have C<My::Extra::Class> and want to unload it,
438
425
simply do this in C<plugin_disable>:
439
426
 
440
 
  require Class::Unload;
441
 
  Class::Unload->unload('My::Extra::Class');
 
427
  $plugin->unload('My::Extra::Class');
442
428
 
443
 
Class::Unload takes care of all the tedious bits for you. Note that you
 
429
The C<unload> method takes care of all the tedious bits for you. Note that you
444
430
should B<not> unload any external C<CPAN> dependencies, as these may be needed
445
431
by other plug-ins or Padre itself. Only classes that are part of your plug-in
446
432
should be unloaded.