-
Notifications
You must be signed in to change notification settings - Fork 2
/
wish_msg
executable file
·77 lines (68 loc) · 2.18 KB
/
wish_msg
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
#!/usr/bin/env wish
# Time-stamp: <2022-07-07 09:20:10>
# Make windows by wish(Tcl/Tk Simple windowing shell)
#
# +---------------------------------------+
# | |
# | Main Message(with color background) |
# | |
# +---------------------------------------+
# | Message 1 |
# | Message 2 |
# | time: hh:mm:ss |
# | +--------+ |
# | | Exit | |
# | +--------+ |
# +---------------------------------------+
#
# Input parameters:
# 1 - main message text
# 2 - color for main message (default: gray)
# 3 - text for message1
# 4 - text for message2
#
# Usage:
# 1. way 1: <this_script_name> [main_message] [color] [message1] [message2]
# 2. way 2: - add new alias/function:
# new_cmd() { ( <compilation_cmd> && <next_cmd> && wish_msg OK green ) || wish_msg Error red; }
# - run new new alias/function
proc help_msg { } {
global lMessage
set help_msg "Example usage: <main_message> <color> <msg1> <msg2>"
set lMessage [label .message -text $help_msg -bg "gray" -width 50 -height 10]
}
if {$argc == 0 || [string match [lindex $argv 0] "--help"]} {
help_msg
} else {
if {$argc > 1} {
set color "[lindex $argv 1]"
} else {
set color "gray"
}
set lMessage [label .message -text "[lindex $argv 0]" -bg $color -width 50 -height 10]
}
set time_end [clock format [clock sec] -format %H:%M:%S]
set lTimeEnd [label .time_end1 -text "time: $time_end"]
if {$argc > 2} {
set lInfo1 [label .info1 -text "[lindex $argv 2]"]
}
if {$argc > 3} {
set lInfo2 [label .info2 -text "[lindex $argv 3]"]
}
set bExit [button .exit -width 8 -text "Exit" -command exit]
wm title . "Info"
pack $lMessage
if {$argc > 2} {
pack $lInfo1
}
if {$argc > 3} {
pack $lInfo2
}
pack $lTimeEnd
pack $bExit -pady {0 5}
# This is for the sake of Emacs.
# Local Variables:
# time-stamp-end: "$"
# time-stamp-format: "<%:y-%02m-%02d %02H:%02M:%02S>"
# time-stamp-start: "Time-stamp: "
# End: