Добавлен диалог клонирования репозитория

This commit is contained in:
svkalinin 2022-11-23 15:21:51 +03:00
parent 9bb25eb817
commit 10dacdb058
3 changed files with 92 additions and 2 deletions

View File

@ -367,6 +367,22 @@ namespace eval Git {
puts $cmd puts $cmd
$w.body.t delete 1.0 end $w.body.t delete 1.0 end
} }
proc Clone {repo dir} {
global activeProject cfgVariables
# puts $values
set cmd exec
lappend cmd $cfgVariables(gitCommand)
lappend cmd "clone"
lappend cmd $repo
lappend cmd $dir
puts $cmd
catch $cmd pipe
puts $pipe
return
}
proc Key {k fr} { proc Key {k fr} {
# puts [Editor::Key $k] # puts [Editor::Key $k]
switch $k { switch $k {
@ -552,6 +568,63 @@ namespace eval Git {
wm geom $win +$x+$y wm geom $win +$x+$y
} }
proc CloneDialog {} {
set win .clone
set x [winfo rootx .frmWork]
set y [winfo rooty .frmWork]
if { [winfo exists $win] } {
destroy $win
return
}
toplevel $win
wm transient $win .
wm overrideredirect $win 1
ttk::entry $win.entUrl
ttk::entry $win.entFolder
ttk::button $win.btnFolder -image folder -command {
set folderPath [tk_chooseDirectory -initialdir $env(HOME) -parent .]
.clone.entFolder insert end $folderPath
}
ttk::button $win.btnClone -compound left -image done_20x20 \
-text [::msgcat::mc "Clone repository"] \
-command {
set folderPath [.clone.entFolder get]
set repo [.clone.entUrl get]
if {$repo eq ""} {return}
if {$folderPath eq ""} {
set folderPath [tk_chooseDirectory -initialdir $env(HOME) -parent .]
if {$folderPath eq ""} {return}
}
set repoDir [file join $folderPath [string trimright [file rootname [file tail $repo]] "."]]
Git::Clone $repo $repoDir
FileOper::ReadFolder $repoDir
ReadFilesFromDirectory $repoDir $repoDir
destroy .clone
}
grid $win.entUrl -row 0 -column 0 -columnspan 2 -sticky new
grid $win.entFolder -row 1 -column 0 -sticky new
grid $win.btnFolder -row 1 -column 1 -sticky e
grid $win.btnClone -row 2 -column 0 -columnspan 2 -sticky new
bind $win <Escape> "destroy $win"
# Определям расстояние до края экрана (основного окна) и если
# оно меньше размера окна со списком то сдвигаем его вверх
set winGeom [winfo reqheight $win]
set topHeight [winfo height .]
# puts "$x, $y, $winGeom, $topHeight"
if [expr [expr $topHeight - $y] < $winGeom] {
set y [expr $topHeight - $winGeom]
}
wm geom $win +$x+$y
focus $win.entUrl
}
proc Dialog {} { proc Dialog {} {
global cfgVariables activeProject nbEditor global cfgVariables activeProject nbEditor
variable fr variable fr
@ -564,6 +637,7 @@ namespace eval Git {
return return
} }
if {[info exists activeProject] == 0} { if {[info exists activeProject] == 0} {
Git::CloneDialog
return return
} }
set fr [NB::InsertItem $nbEditor git_browse "git"] set fr [NB::InsertItem $nbEditor git_browse "git"]

View File

@ -1263,3 +1263,19 @@ image create photo refresh_11x11 -data {
eWYer/e+iVJK4gvu4wqWOMMNXMKv1Wr1eDAYnFR4OplMHlZVdQ9l/dwufmTmh7qu7w4GgxP4C5QM eWYer/e+iVJK4gvu4wqWOMMNXMKv1Wr1eDAYnFR4OplMHlZVdQ9l/dwufmTmh7qu7w4GgxP4C5QM
b3lPIiauAAAAAElFTkSuQmCC b3lPIiauAAAAAElFTkSuQmCC
} }
image create photo folder_24x24 -data {
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9
kT1Iw0AcxV9TRakVEQuKOGSoThbELxy1CkWoEGqFVh1MLv2CJg1Jiouj4Fpw8GOx6uDirKuDqyAI
foA4OjkpukiJ/0sKLWI9OO7Hu3uPu3eAUC0yzWobAzTdNhOxqJhKr4odr+hCPwKYQq/MLGNOkuJo
Ob7u4ePrXYRntT735+hWMxYDfCLxLDNMm3iDeHrTNjjvE4dYXlaJz4lHTbog8SPXFY/fOOdcFnhm
yEwm5olDxGKuiZUmZnlTI54kDquaTvlCymOV8xZnrVhm9XvyFwYz+soy12kOIYZFLEGCCAVlFFCE
jQitOikWErQfbeEfdP0SuRRyFcDIsYASNMiuH/wPfndrZSfGvaRgFGh/cZyPYaBjF6hVHOf72HFq
J4D/GbjSG/5SFZj5JL3S0MJHQM82cHHd0JQ94HIHGHgyZFN2JT9NIZsF3s/om9JA3y0QWPN6q+/j
9AFIUlfxG+DgEBjJUfZ6i3d3Nvf275l6fz+MS3KxGoYR/gAAAAZiS0dEAP8A/wD/oL2nkwAAAAlw
SFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB+YLFwo2Gs8+4dEAAAERSURBVEjH7ZW/SsUwFMa//KGQ
Wyhka0ffQ6QP0G6+iIhv0Nm9c0eHYOeCm8ud3EoXiwhSqJNLh6RxsXLVit5eAw79IHBOODk/Dicn
AVb9IDIZaZpuGGPHnHP2OcgY86KUugUwLgYkSXJljDmdDSIEnPPzsiwvFwPiOL6x1sbfBQoh7oUQ
D7/IuVVKXUwOnwxrLQAgiiJIKecOHr2tWQ3DgLZtwRg7AfAVoLWmYRgiy7LFDS2KAlVVkd29dwBj
LAKAPM8XA7qug+d5mAX4vh9qrdE0zUHXMgiCDz7d6QFxMQfU9aCtgH8EIIRo1xU8OgVYa43rCp7+
IuE4js+zT0Vd12dSymtK6UET3ff93fqP76VXznxN1iafwLQAAAAASUVORK5CYII=
}

View File

@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
###################################################### ######################################################
# Version: 2.0.0 # Version: 2.0.0
# Release: alpha # Release: alpha
# Build: 23112022115108 # Build: 23112022125023
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.