[PATCH 2 of 9] hgk: fix pop-up windows
Andrew Shadura
bugzilla at tut.by
Wed Nov 7 09:15:10 CST 2012
# HG changeset patch
# User Andrew Shadura <bugzilla at tut.by>
# Date 1350394316 -7200
# Node ID 6e00dd025800b8863a2e5ea56c436485a0911a0b
# Parent e938f499c00812ee7b5326386a18b422ce6fa498
hgk: fix pop-up windows
Create pop-up windows properly so they go to the floating layer in
tiling window managers. Also, replace labels with window titles.
diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -101,6 +101,18 @@ proc gitdir {} {
}
}
+proc popupify {w} {
+ wm resizable $w 0 0
+ wm withdraw $w
+ update
+ set x [expr {([winfo screenwidth .]-[winfo reqwidth $w])/2}]
+ set y [expr {([winfo screenheight .]-[winfo reqheight $w])/2}]
+ wm geometry $w +$x+$y
+ wm transient $w .
+ wm deiconify $w
+ wm resizable $w 1 1
+}
+
proc getcommits {rargs} {
global commits commfd phase canv mainfont env
global startmsecs nextupdate ncmupdate
@@ -491,6 +503,7 @@ proc error_popup msg {
ttk::button $w.ok -text OK -command "destroy $w"
pack $w.ok -side bottom -fill x
bind $w <Visibility> "grab $w; focus $w"
+ popupify $w
tkwait window $w
}
@@ -927,6 +940,7 @@ Use and redistribute under the terms of
pack $w.m -side top -fill x -padx 20 -pady 20
ttk::button $w.ok -text Close -command "destroy $w"
pack $w.ok -side bottom
+ popupify $w
}
set aunextcolor 0
@@ -3698,13 +3712,11 @@ proc mkpatch {} {
set patchtop $top
catch {destroy $top}
toplevel $top
- ttk::label $top.title -text "Generate patch"
- grid $top.title - -pady 10
ttk::label $top.from -text "From:"
ttk::entry $top.fromsha1 -width 40
$top.fromsha1 insert 0 $oldid
$top.fromsha1 conf -state readonly
- grid $top.from $top.fromsha1 -sticky w
+ grid $top.from $top.fromsha1 -sticky w -pady {10 0}
ttk::entry $top.fromhead -width 60
$top.fromhead insert 0 $oldhead
$top.fromhead conf -state readonly
@@ -3733,6 +3745,8 @@ proc mkpatch {} {
grid columnconfigure $top.buts 1 -weight 1 -uniform a
grid $top.buts - -pady 10 -sticky ew
focus $top.fname
+ popupify $top
+ wm title $top "Generate a patch"
}
proc mkpatchrev {} {
@@ -3778,13 +3792,11 @@ proc mktag {} {
set mktagtop $top
catch {destroy $top}
toplevel $top
- ttk::label $top.title -text "Create tag"
- grid $top.title - -pady 10
ttk::label $top.id -text "ID:"
ttk::entry $top.sha1 -width 40
$top.sha1 insert 0 $rowmenuid
$top.sha1 conf -state readonly
- grid $top.id $top.sha1 -sticky w
+ grid $top.id $top.sha1 -sticky w -pady {10 0}
ttk::entry $top.head -width 60
$top.head insert 0 [lindex $commitinfo($rowmenuid) 0]
$top.head conf -state readonly
@@ -3800,6 +3812,8 @@ proc mktag {} {
grid columnconfigure $top.buts 1 -weight 1 -uniform a
grid $top.buts - -pady 10 -sticky ew
focus $top.tag
+ popupify $top
+ wm title $top "Create a tag"
}
proc domktag {} {
@@ -3858,13 +3872,11 @@ proc writecommit {} {
set wrcomtop $top
catch {destroy $top}
toplevel $top
- ttk::label $top.title -text "Write commit to file"
- grid $top.title - -pady 10
ttk::label $top.id -text "ID:"
ttk::entry $top.sha1 -width 40
$top.sha1 insert 0 $rowmenuid
$top.sha1 conf -state readonly
- grid $top.id $top.sha1 -sticky w
+ grid $top.id $top.sha1 -sticky w -pady {10 0}
ttk::entry $top.head -width 60
$top.head insert 0 [lindex $commitinfo($rowmenuid) 0]
$top.head conf -state readonly
@@ -3884,6 +3896,8 @@ proc writecommit {} {
grid columnconfigure $top.buts 1 -weight 1 -uniform a
grid $top.buts - -pady 10 -sticky ew
focus $top.fname
+ popupify $top
+ wm title $top "Write commit to a file"
}
proc wrcomgo {} {
More information about the Mercurial-devel
mailing list