-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathgui_wait.pm
99 lines (84 loc) · 1.62 KB
/
gui_wait.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package gui_wait;
use strict;
use Tk;
use Tk::WaitBox_kh;
use Time::Local;
use POSIX 'strftime';
use gui_errormsg;
my $win;
sub start{
my $class = shift;
my $self;
my $d = [localtime];
if ($win){
$win->configure(-txt1 => "Start: ".strftime('%Y %m/%d %H:%M:%S',@{$d}));
#print "gui_wait: re-using...\n";
} else {
#print "gui_wait: making new...\n";
$win = $::main_gui->mw->WaitBox_kh(
-title => 'KH Coder is processing data...',
-txt1 => "Start: ".strftime('%Y %m/%d %H:%M:%S',@{$d}),
-background => 'white',
-takefocus => 0
);
}
if (
($::config_obj->os eq 'win32')
&& (eval 'require Tk::Icon' )
) {
$win->Show;
require Tk::Icon;
$win->setIcon(-file => Tk->findINC('1.ico') );
} else {
eval'$win->Icon(-image => \'window_icon\')';
$win->Show;
}
$self->{started} = timelocal(@{$d});
bless $self, $class;
return $self;
}
sub end{
my $self = shift;
my %args = @_;
my $e = timelocal(localtime) - $self->{started};
my ($h, $m, $s);
if ($e >= 3600){
$h = int($e / 3600);
$e %= 3600;
if ($h < 10){
$h = "0"."$h";
}
} else {
$h = "00";
}
if ($e >= 60){
$m = int($e / 60);
$e %= 60;
if ($m < 10){
$m = "0"."$m";
}
} else {
$m = "00";
}
if ($e < 10){
$s = "0"."$e";
} else {
$s = $e;
}
if ( $args{no_dialog} ){
print "done: $h:$m:$s\n";
} else {
gui_errormsg->open(
msg => kh_msg->get('done')." $h:$m:$s",#"処理が完了しました。\n経過時間:
type => 'msg',
icon => 'info',
window => \$win,
);
}
$win->unShow unless $::config_obj->os eq 'win32';
$win->{bitmap}->destroy;
$win->destroy;
undef $win;
return 1;
}
1;