~ubuntu-branches/ubuntu/wily/padre/wily

« back to all changes in this revision

Viewing changes to share/examples/wx/21_progress_bar.pl

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2009-08-12 14:44:55 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090812144455-yvk90oa92khfcnls
Tags: 0.42-1
* New Upstream Version
  + add explicit dependency on libtest-simple-perl (>= 0.88)
  + rules: use dh --with quilt (and bump quilt build-dependency to 0.46-7)
  + rules: no need to re-generate .mo files from .po. Upstream does it now
  + copyright: describe share/icons/padre/16x16/logo.png
    - describe share/icons/padre/16x16/toggle-comments.png
    - Padre license is the same as Perl (i.e. not Perl 5)
    - update list of copright holders
    - also list translators
  + drop libtest-most-perl from build-dependencies
  + add liblocale-msgfmt-perl to build-dependencies
  + add libcapture-tiny-perl to (build-)dependencies
  + add libfile-remove-perl (>= 1.42) to (build-)dependencies
  + drop libmodule-inspector-perl from (build-)dependencies
  + add libppix-editortools-perl to (build-)dependencies
  + add libparse-exuberantctags-perl to (build-)dependencies
  + patches:
    - drop lower-wx-requirement-to-2.8.7.patch and replace it with
      SKIP_WXWIDGETS_VERSION_CHECK=1 when configuring
      adjust README.debian accordingly
    - refresh disable-tcp-server.patch
    - drop don't-require-new-file-path.patch (applied upstream)
    - rework fix-pod2-errors.patch (new release, new errors :))
* add fix-perl-interpreter-path.patch fixing the path to the perl interpreter
  in three examples (thanks lintian)
* add more lintian overrides about script-not-executable for scripts that are
  treated as examples/templates
* add fix-whatis.patch fixing the whatis entry of Padre::Wx
* add menu and .desktop file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use strict;
 
3
use warnings;
 
4
 
 
5
#############################################################################
 
6
##
 
7
## Based on lib/Wx/DemoModules/wxProgressDialog.pm 
 
8
## from the wxDemo ## written by Mattia Barbon
 
9
## Copyright:   (c) The Padre development team
 
10
## Licence:     This program is free software; you can redistribute it and/or
 
11
##              modify it under the same terms as Perl itself
 
12
#############################################################################
 
13
 
 
14
use Wx qw(:progressdialog);
 
15
show_progress_bar();
 
16
 
 
17
sub show_progress_bar {
 
18
    my( $window ) = @_;
 
19
 
 
20
    my $max = 20;
 
21
 
 
22
    my $dialog = Wx::ProgressDialog->new( 'Progress dialog example',
 
23
                                          'An informative message',
 
24
                                          $max, $window,
 
25
                                          wxPD_CAN_ABORT|wxPD_AUTO_HIDE|
 
26
                                          wxPD_APP_MODAL|wxPD_ELAPSED_TIME|
 
27
                                          wxPD_ESTIMATED_TIME|
 
28
                                          wxPD_REMAINING_TIME );
 
29
 
 
30
    my $continue;
 
31
    foreach my $i ( 1 .. $max ) {
 
32
        sleep 1;
 
33
        if( $i == $max ) { 
 
34
            $continue = $dialog->Update( $i, "That's all, folks!" );
 
35
        } elsif( $i == int( $max / 2 ) ) {
 
36
            $continue = $dialog->Update( $i, "Only a half left" );
 
37
        } else {
 
38
            $continue = $dialog->Update( $i );
 
39
        }
 
40
        last unless $continue;
 
41
    }
 
42
 
 
43
    Wx::LogMessage( $continue ? "Countdown from $max finished" :
 
44
                                "Progress dialog aborted" );
 
45
 
 
46
    $dialog->Destroy;
 
47
}
 
48