2007-05-08 05:35:48 +02:00
|
|
|
# git-gui branch (create/delete) support
|
|
|
|
# Copyright (C) 2006, 2007 Shawn Pearce
|
|
|
|
|
2008-02-21 05:37:07 +01:00
|
|
|
proc _error_parent {} {
|
2008-02-21 18:22:08 +01:00
|
|
|
set p [grab current .]
|
|
|
|
if {$p eq {}} {
|
|
|
|
return .
|
|
|
|
}
|
|
|
|
return $p
|
2008-02-21 05:37:07 +01:00
|
|
|
}
|
|
|
|
|
2007-05-08 05:35:48 +02:00
|
|
|
proc error_popup {msg} {
|
|
|
|
set title [appname]
|
|
|
|
if {[reponame] ne {}} {
|
|
|
|
append title " ([reponame])"
|
|
|
|
}
|
|
|
|
set cmd [list tk_messageBox \
|
|
|
|
-icon error \
|
|
|
|
-type ok \
|
2016-05-08 12:52:57 +02:00
|
|
|
-title [mc "%s: error" $title] \
|
2007-05-08 05:35:48 +02:00
|
|
|
-message $msg]
|
2008-02-21 05:37:07 +01:00
|
|
|
if {[winfo ismapped [_error_parent]]} {
|
|
|
|
lappend cmd -parent [_error_parent]
|
2007-05-08 05:35:48 +02:00
|
|
|
}
|
|
|
|
eval $cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
proc warn_popup {msg} {
|
|
|
|
set title [appname]
|
|
|
|
if {[reponame] ne {}} {
|
|
|
|
append title " ([reponame])"
|
|
|
|
}
|
|
|
|
set cmd [list tk_messageBox \
|
|
|
|
-icon warning \
|
|
|
|
-type ok \
|
2016-05-08 12:52:57 +02:00
|
|
|
-title [mc "%s: warning" $title] \
|
2007-05-08 05:35:48 +02:00
|
|
|
-message $msg]
|
2008-02-21 05:37:07 +01:00
|
|
|
if {[winfo ismapped [_error_parent]]} {
|
|
|
|
lappend cmd -parent [_error_parent]
|
2007-05-08 05:35:48 +02:00
|
|
|
}
|
|
|
|
eval $cmd
|
|
|
|
}
|
|
|
|
|
2008-02-21 05:37:07 +01:00
|
|
|
proc info_popup {msg} {
|
2007-05-08 05:35:48 +02:00
|
|
|
set title [appname]
|
|
|
|
if {[reponame] ne {}} {
|
|
|
|
append title " ([reponame])"
|
|
|
|
}
|
|
|
|
tk_messageBox \
|
2008-02-28 07:28:45 +01:00
|
|
|
-parent [_error_parent] \
|
2007-05-08 05:35:48 +02:00
|
|
|
-icon info \
|
|
|
|
-type ok \
|
|
|
|
-title $title \
|
|
|
|
-message $msg
|
|
|
|
}
|
|
|
|
|
|
|
|
proc ask_popup {msg} {
|
|
|
|
set title [appname]
|
|
|
|
if {[reponame] ne {}} {
|
|
|
|
append title " ([reponame])"
|
|
|
|
}
|
2007-07-18 04:45:53 +02:00
|
|
|
set cmd [list tk_messageBox \
|
2007-05-08 05:35:48 +02:00
|
|
|
-icon question \
|
|
|
|
-type yesno \
|
|
|
|
-title $title \
|
|
|
|
-message $msg]
|
2008-02-21 05:37:07 +01:00
|
|
|
if {[winfo ismapped [_error_parent]]} {
|
|
|
|
lappend cmd -parent [_error_parent]
|
2007-07-18 04:45:53 +02:00
|
|
|
}
|
|
|
|
eval $cmd
|
2007-05-08 05:35:48 +02:00
|
|
|
}
|
|
|
|
|
2008-01-20 20:46:59 +01:00
|
|
|
proc hook_failed_popup {hook msg {is_fatal 1}} {
|
2010-01-26 01:05:31 +01:00
|
|
|
global use_ttk NS
|
2007-05-08 05:35:48 +02:00
|
|
|
set w .hookfail
|
2010-01-26 01:05:31 +01:00
|
|
|
Dialog $w
|
|
|
|
wm withdraw $w
|
2007-05-08 05:35:48 +02:00
|
|
|
|
2010-01-26 01:05:31 +01:00
|
|
|
${NS}::frame $w.m
|
2016-05-08 12:52:58 +02:00
|
|
|
${NS}::label $w.m.l1 -text [mc "%s hook failed:" $hook] \
|
2007-05-08 05:35:48 +02:00
|
|
|
-anchor w \
|
|
|
|
-justify left \
|
|
|
|
-font font_uibold
|
|
|
|
text $w.m.t \
|
2008-03-05 17:54:22 +01:00
|
|
|
-background white \
|
|
|
|
-foreground black \
|
|
|
|
-borderwidth 1 \
|
2007-05-08 05:35:48 +02:00
|
|
|
-relief sunken \
|
|
|
|
-width 80 -height 10 \
|
|
|
|
-font font_diff \
|
|
|
|
-yscrollcommand [list $w.m.sby set]
|
2010-01-26 01:05:31 +01:00
|
|
|
${NS}::scrollbar $w.m.sby -command [list $w.m.t yview]
|
2007-05-08 05:35:48 +02:00
|
|
|
pack $w.m.l1 -side top -fill x
|
2008-01-20 20:46:59 +01:00
|
|
|
if {$is_fatal} {
|
2010-01-26 01:05:31 +01:00
|
|
|
${NS}::label $w.m.l2 \
|
2008-01-20 20:46:59 +01:00
|
|
|
-text [mc "You must correct the above errors before committing."] \
|
|
|
|
-anchor w \
|
|
|
|
-justify left \
|
|
|
|
-font font_uibold
|
|
|
|
pack $w.m.l2 -side bottom -fill x
|
|
|
|
}
|
2007-05-08 05:35:48 +02:00
|
|
|
pack $w.m.sby -side right -fill y
|
|
|
|
pack $w.m.t -side left -fill both -expand 1
|
|
|
|
pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
|
|
|
|
|
|
|
|
$w.m.t insert 1.0 $msg
|
|
|
|
$w.m.t conf -state disabled
|
|
|
|
|
2010-01-26 01:05:31 +01:00
|
|
|
${NS}::button $w.ok -text OK \
|
2007-05-08 05:35:48 +02:00
|
|
|
-width 15 \
|
|
|
|
-command "destroy $w"
|
|
|
|
pack $w.ok -side bottom -anchor e -pady 10 -padx 10
|
|
|
|
|
|
|
|
bind $w <Visibility> "grab $w; focus $w"
|
|
|
|
bind $w <Key-Return> "destroy $w"
|
2016-05-08 12:52:55 +02:00
|
|
|
wm title $w [mc "%s (%s): error" [appname] [reponame]]
|
2010-01-26 01:05:31 +01:00
|
|
|
wm deiconify $w
|
2007-05-08 05:35:48 +02:00
|
|
|
tkwait window $w
|
|
|
|
}
|